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
Spring

Getting started with Docker Compose integration in Spring Boot 3.1

Spring Boot 3.1 has Docker Compose support. This feature enhances the development experience and removes the overhead of managing containers and ports. With the 3.1 release, Spring Boot automatically detects the random port numbers assigned by the Docker host and sets them in the application at runtime without any configuration or code changes. This article […]

Categories
Spring

Change Spring Boot log level at runtime with actuator

Spring Boot actuator allows changing an application log at runtime at a granular level. In this article, we cover how to change a Spring Boot application log level at runtime with the actuator endpoint. The prerequisite for changing the log level at runtime is to expose the logger actuator. We do that by adding the […]

Exit mobile version