JUnit5 Writing first Test

September 21, 2020 | No comments

JUnit5 Writing first Test

JUnit 5 is the latest version of Junit. It has a brand new architecture and more capabilities compared to the previous generation of Junit. In this article, we will quickly go through some of the main features and concepts of JUnit 5. In this Article we will start with our first JUnit 5 Test.
First Junit5 Test. This test has only one test method which asserts that the message string is equal to "hello"
package com.bootng.start;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class SimpleHelloTest {

	public void test_hello() {
		String msg = "hello";
		assertEquals(msg, "hello", " message is equal Hello");


When running this test, the test will surely pass since the assert condition will be successfull.

No comments :

Post a Comment

Please leave your message queries or suggetions.