Category: Java
-
Faster Testing of the JPA Repository in Spring Applications
In the ‘Clean Code‘ book, Uncle Bob defined the five characteristics of a clean test. Those characteristics have the acronym FIRST; which stands for Fast, Independent, Repeatable, Self-Validating, and Timely. For this post, let’s focus on the ‘Fast‘ attribute! Here, I will demonstrate (through code) how to make testing the repository layer of the Spring Application…
-
Factory Pattern: Replacing the Conditional Statement with Lambda Expressions
The “Factory Pattern” falls under the creational design patterns and is most widely used in Java applications. Similar to the other patterns, this pattern helps us write organized and clean code. But, for me, the conditional statement in the “Factory Pattern” presents a possible breach of the clean code principles, especially as the number of…
-
Mars Rover – Refactoring Kata
On several occasions, I have used the Mars Rover challenge to train developers on TDD principles. This time, I am using it as a refactoring Kata! I submitted the initial code on my GitHub repository that covers all the cases except the edge ones. But, the code I’ve written is in bad shape. How to…
-
Tutorial: How to configure maven surefire plugin work with JUnit 5
Recently, I had a task to migrate the unit tests in our project from ‘JUnit 4’ to ‘JUnit 5’. As many developers, I researched a bit to learn about the major differences between the two versions and drafted a plan for smooth migration. From the first look, I thought my only job was refactoring the…