@RunWith in JUnit5 (#2935)
* @RunWith in JUnit5 * Greetings class moved to com.baeldung.junit5 package
This commit is contained in:
parent
52eb1380b6
commit
9414864a46
9
junit5/src/main/java/com/baeldung/junit5/Greetings.java
Normal file
9
junit5/src/main/java/com/baeldung/junit5/Greetings.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package com.baeldung.junit5;
|
||||||
|
|
||||||
|
public class Greetings {
|
||||||
|
|
||||||
|
public static String sayHello() {
|
||||||
|
return "Hello";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
19
junit5/src/test/java/com/baeldung/GreetingsTest.java
Normal file
19
junit5/src/test/java/com/baeldung/GreetingsTest.java
Normal file
@ -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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user