Sign in

There are numerous cases where a service needs to make use of the APIs from other services.

On the provider side, it might be sufficient to write unit tests to verify that the endpoints provide the data with appropriate fields and data types. …

This article shows a few ways of writing unit tests to test drive the controller and service layers of a Reactive application.

How to test Functional Endpoints

Functional endpoints can be mapped by defining a RouterFunction bean. Let us look at an example below which maps 4 endpoints. It can be observed that each endpoint…

In this article, we will look at a sample Spring Boot application using Spring GraphQL Boot Starter. This example will cover how to implement controller for GraphQL schema and how to write test code.

According to the Spring GraphQL reference, the following dependency needs to be added to pom.xml.


In this article, different propagation properties will be tested.

Test code will make use of two services. To make it easier to distinguish the hierarchy of the two services, I will name them as ParentService and ChildService.

ParentService Implementation

To make things simpler, ParentService simply saves some data and invokes ChildService like…

There may be some situations where user information is required as part of business logic. Quite often, this process takes place after authentication. In this article, let us find out how user information can be obtained as well as how to write unit tests for such cases.

First of all…

When doing test-driven development, it might be easier to stub the return values of APIs or async calls. But there will be cases where stubbing the states inside the store might be helpful.

Full source code can be found here.

The idea is to create an initial state of the reducer the test is interested in before each render.

Let us assume there are three different reducers.

store.js (rootReducer)

The reducer I would like to test is the cartReducer shown below.

cart-index.js (cartReducer)

Lastly, renderWithStore receives the initial cart state before the actual render. The idea is that each test or test group may have different states to begin with. Therefore, the states can be easily overridden based on what is being tested.

Sample of a countdown timer using React

Countdown timer

This article is focused on how to test drive a Spring Boot application using Spring Security. I decided to put this together because there is a lot of Spring involved when using Spring Security and because of that testing can be a little bit difficult and slow.

Full source code…

Swagger Configuration
Swagger Dependencies

[UPDATE] Applying Swagger UI with OpenAPI 3.0


Add the following dependency and run the application.


For Functional Endpoints (Webflux)

Add the following dependency and run the application.


The API documentation will be displayed at /swagger-ui.html by default. If you want to change the path of the swagger-ui, a value can be set to springdoc.swagger-ui.path in or yml.

[Spring Boot] How to configure H2 database and H2 console

Using Spring Initializer, add the following dependencies: H2 Database, Spring Data JPA, Spring Web.

If you run the main class without doing anything, it will run successfully and it will use in-memory H2 database by default.

To view the H2…


Welcome to Jay’s blog. This blog is for myself to keep notes. Feel free to take a look and share.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store