From 9414864a46c394c50f4183a0f969dd3958463986 Mon Sep 17 00:00:00 2001 From: Marcos Lopez Gonzalez Date: Thu, 2 Nov 2017 22:42:33 +0100 Subject: [PATCH] @RunWith in JUnit5 (#2935) * @RunWith in JUnit5 * Greetings class moved to com.baeldung.junit5 package --- .../java/com/baeldung/junit5/Greetings.java | 9 +++++++++ .../test/java/com/baeldung/GreetingsTest.java | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 junit5/src/main/java/com/baeldung/junit5/Greetings.java create mode 100644 junit5/src/test/java/com/baeldung/GreetingsTest.java diff --git a/junit5/src/main/java/com/baeldung/junit5/Greetings.java b/junit5/src/main/java/com/baeldung/junit5/Greetings.java new file mode 100644 index 0000000000..f43269f646 --- /dev/null +++ b/junit5/src/main/java/com/baeldung/junit5/Greetings.java @@ -0,0 +1,9 @@ +package com.baeldung.junit5; + +public class Greetings { + + public static String sayHello() { + return "Hello"; + } + +} diff --git a/junit5/src/test/java/com/baeldung/GreetingsTest.java b/junit5/src/test/java/com/baeldung/GreetingsTest.java new file mode 100644 index 0000000000..e894d5857c --- /dev/null +++ b/junit5/src/test/java/com/baeldung/GreetingsTest.java @@ -0,0 +1,19 @@ +package com.baeldung; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; +import org.junit.platform.runner.JUnitPlatform; +import org.junit.runner.RunWith; + +import com.baeldung.junit5.Greetings; + +@RunWith(JUnitPlatform.class) +public class GreetingsTest { + + @Test + void whenCallingSayHello_thenReturnHello() { + assertTrue("Hello".equals(Greetings.sayHello())); + } + +}