Skip to content

Commit 9414864

Browse files
marcos-lgpivovarit
authored andcommitted
@RunWith in JUnit5 (eugenp#2935)
* @RunWith in JUnit5 * Greetings class moved to com.baeldung.junit5 package
1 parent 52eb138 commit 9414864

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.baeldung.junit5;
2+
3+
public class Greetings {
4+
5+
public static String sayHello() {
6+
return "Hello";
7+
}
8+
9+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.baeldung;
2+
3+
import static org.junit.jupiter.api.Assertions.assertTrue;
4+
5+
import org.junit.jupiter.api.Test;
6+
import org.junit.platform.runner.JUnitPlatform;
7+
import org.junit.runner.RunWith;
8+
9+
import com.baeldung.junit5.Greetings;
10+
11+
@RunWith(JUnitPlatform.class)
12+
public class GreetingsTest {
13+
14+
@Test
15+
void whenCallingSayHello_thenReturnHello() {
16+
assertTrue("Hello".equals(Greetings.sayHello()));
17+
}
18+
19+
}

0 commit comments

Comments
 (0)