Categories
Java

Generate and sign messages with RSA in Java

RSA stands for Rivest Shamir Adleman. It is one of the oldest yet most widely used. RSA is a public-key cryptosystem that is suitable for transmitting data securely. In this article, we cover how to generate and sign messages with RSA in Java. How RSA works When generating an RSA, a key pair is generated, […]

Categories
Java

Assert exceptions in AssertJ

Besides JUnit, AssertJ is another popular testing framework for Java that provides a fluent API for writing clear and concise test assertions. It improves the readability of test code and provides comprehensive support for Java objects and collections. One of the areas in which AssertJ shines is the exception assertion. In this article, we cover […]

Categories
Java

Mockito return based on the input parameter

Mockito, the defacto mocking library in the Java world that is widely adopted. It is used one way or another by almost any Java project. Mockito is known for its versatility which offers powerful features for dynamic testing scenarios. In this article, we discuss how to return a result of a mock object based on […]

Categories
Java

Pass null values in JUnit 5 @CsvSource

JUnit 5 @CsvSource allows writing parameterized tests without creating a CSV file or writing a method to feed data. However, handling nulls is not provided out of the box and requires a bit of configuration. In this article, we cover how to pass null values in JUnit 5 @CsvSource annotation. Let’s start by writing a […]

Categories
Java Kotlin Spring

Spring Boot Swagger documentation using OpenAPI

Rich API documentation is a vital element of any successful project, especially if it has to be integrated by third parties. Unfortunately, Spring Boot does not have an out-of-the-box solution for Swagger documentation. So we must use a third-party library (Springdoc-openapi) for that purpose. In this article, we cover how to add Spring Boot Swagger […]

Categories
Java

Three ways to patch Log4Shell CVE-2021-44228 vulnerability

As you may have heard over the news, a new vulnerability (CVE-2021-44228) was discovered in Log4j 2 library by Alibaba. This zero-day vulnerability allows remote code execution and potentially affect millions of services across the globe. In this article, we go through three possible ways to patch Log4Shell CVE-2021-44228 vulnerability. Update on 11 December 16:10 […]

Exit mobile version