Home » Tag Archives: JUnit

Tag Archives: JUnit

@ParameterizedTest with null values in @CvsSource

Writing parameterized tests in JUnit 4 was pretty cumbersome. JUnit 5 introduced several useful improvements to the framework and running the same test with different arguments is much simpler than in the previous version. However, there is one small issue with passing null values in such arguments. In this post, I’m going to show you how to pass null in ...

Read More »

Blow up Your JUnit5 Tests with Permutations

Writing JUnit tests can be a tedious and boring process. Learn how you can improve your tests classes using permutations in combination with TestFactory methods and DynamicTest objects with a minimum of coding effort. In this article, I will use the Java stream ORM Speedment because it includes a ready-madePermutation class and thereby helps me save development time. Speedment otherwise allows database tables ...

Read More »

Spring with Maven Tutorial

spring-interview-questions-answers

1. Introduction In this post, we shall demonstrate how to use Maven dependencies for Spring for very specific use-cases. The latest versions of all the libraries we use can be found on the Maven Central. Understanding how Maven dependencies work and how they are managed, is important in a project for an effective build cycle and the clear concepts about ...

Read More »

Ant 1.10.3 released with JUnit 5 support

We just released 1.9.11 and 1.10.3 versions of Ant today. The downloads are available on the Ant project’s download page. Both these releases are mainly bug fix releases, especially the 1.9.11 version. The 1.10.3 release is an important one for a couple of reasons. The previous 1.10.2 release, unintentionally introduced a bunch of changes which caused regressions in various places in Ant ...

Read More »

Kotlin and JUnit 5 @BeforeAll

Introduction In Kotlin, classes do not have static methods. A Java equivalent semantic can be provided to callers using the concept of a companion object though. This post will go into details of what it takes to support a JUnit 5 @BeforeAll and @AfterAll annotation which depend on the precense of a static methods in test classes. BeforeAll and AfterAll in Java Junit ...

Read More »

JUnit Hamcrest Matcher for JSON

This post shows how you can write JUnit tests to check if an object matches a JSON string. This is important if you are implementing REST services and want to test if your service produces the expected JSON response. A useful library for comparing JSON objects is JSONassert. First, you have to convert your Java object into a JSON string ...

Read More »