In this article you will find the approach of writing integration tests for the persistence layer using Spring Boot, Testcontainers, DbRider, Datasource Proxy.

All test examples are persistence layer agnostic — it means that the persistence layer can be implemented only using JDBC specification (without JPA specification)

This is the second article about Persistence Layer implementation and testing. The first article can be found here.

Also, you can find the full source code on the GitHub page.

But now let's jump right into the tests.

First of all, we will create our own annotation @PersistenceLayerTest and hide all configurations there…


In this article you will find an example of combining the two most powerful frameworks for building maintainable and type-safe persistence layer. From Spring Data JPA we will take only CRUD operations and for all complex queries we will use QueryDSL.

You can find the full project on GitHub using this link. There is a simple SpringBoot application with configured MySQL datasource and initial database structure described as a Flyway migration.

Here we will concentrate only on the building persistence layer. As we deal with the relational database we will rely on the JPA specification. …


In this article we will look at the problem of using the current time in the code and one of the solutions that I am fond of.

Using reference to the current date/time in the source code makes testing pretty difficult. You have to exclude such references from your assertions that sometimes is not a trivial task.

If we would like to avoid current time inconveniences during testing, time mocking is an answer. Here we will look at the example with mocking time using the new Java 8 Date/Time API (JSR 310).

For obtaining the current moment in time all…


Disclaimer: This is my personal experience and your experience may be completely different.

Before explaining the reason for such a provoking story header, let me briefly tell you my personal background and attitude toward OCP certification.

I have been working with Java for more than 10 years and currently holding the OCP Java SE 8 Programmer certificate. My path to it was the following:

  • Archive “Oracle Certified Professional, Java SE 6 Programmer” certificate (10-AUG-2011 — 1Z0–851 Exam)
  • Upgrade to the “Oracle Certified Professional, Java SE 8 Programmer” title (25-MAY-2017 — 1Z0–813 Exam)

Dmytro Stepanyshchenko

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