Getting started with JUnit assumptions

Assumptions are similar to assertions, except that assumptions must hold true or the test will be aborted. In contrast, when an assertion fails, the test is considered to have failed. JUnit Assumptions helps us in skipping a test for some specific scenario. Sometimes our test cases are dependent on the inputs, operating systems or any … Read more

How to Tag Tests in JUnit 5

In this tutorial, we are going to learn how to Tag Tests using JUnit Jupiter tests. Test classes and methods can be tagged in the JUnit 5 programming model by means of the annotation @Tag. Those tags can later be used to filter test discovery and execution. In this example, we see the use of … Read more

Managing JUnit Test Timeout

If you want to ensure that a test fails if it isn’t done in a certain amount of time you can use the assertTimeout() method. This ensures that tests that take too long, can be automatically failed. Here is an example package com.example; import static org.junit.Assert.assertEquals; import static java.time.Duration.ofMillis; import static java.time.Duration.ofMinutes; import static org.junit.jupiter.api.Assertions.assertTimeout; … Read more

How to run a single test in Maven

How to run a single Class Test with Maven Open a terminal and from the Maven project directory (which contains a valid pom.xml file) you can execute the following command: mvn -Dtest=ExampleTest test where ExampleTest is a class which contains a Test in it. How to run a single Test from a Class with Maven … Read more

JUnit 5 Lifecycle methods

In this tutorial we will learn how to use @BeforeEach, @AfterEach @BeforeAll and @AfterAll annotations to execute fixtures in your JUnit 5 Test Classes. @BeforeEach @BeforeEach is used to signal that the annotated method should be executed before each @Test method in the current test class. It is equivalent to JUnit 4’s @Before. Example: package … Read more

Performing a FlyWay migration with Quarkus and Thorntail

This second tutorial about FlyWay will show you how to run a Migration using Quarkus and Thorntail using PostgreSQL Database. Flyway is an open-source library that lets you to automate version-based database migrations. Flyway records of all applied migrations into your RDBMs so that it can detect and execute the required migration steps to update … Read more

Introduction to Zookeeper

What is Zookeeper ? Apache ZooKeeper is an opensource project which can be used to develop a highly scalable, robust and reliable centralized service to implement coordination in a distributed environment. It enables application developers to concentrate on the core business logic of their applications and let the ZooKeeper service to get the coordination part … Read more

Zookeeper tutorial

In this ZooKeeper tutorial we will learn how to download, install and move our first steps with Zookeeper distributed coordination system. ZooKeeper is implemented in Java and requires Java 6 or later versions to run. While Oracle’s version of Java is recommended, OpenJDK should also work fine for the correct functioning of ZooKeeper Oracle’s version … Read more

Clustering Zookeeper

In this tutorial we have learnt how to set up a ZooKeeper server instance in standalone mode: Zookeeper quickstart. A standalone instance is a potential single point of failure. If the ZooKeeper server fails, the whole application that was using the instance for its distributed coordination will fail and stop functioning. Hence, running ZooKeeper in … Read more

Quick introduction to Vagrant

Vagrant is a program that enables you to create portable and reproducible development environments easily supporting many hosts and guests operating systems and various features such as synced folders, forwarded ports and support for famous provisioners such as Chef, Puppet or Ansible. If you have been using tools like Virtual Box you may think of … Read more