Skip to content

Commit 1e6f0da

Browse files
yasin3061maibin
authored andcommitted
BAEL-926 Upgrade Junit 5 dependencies to use M4 (eugenp#1802)
* BAEL-88 Testing in Spring Boot * BAEL-88 Integration tests fixed. * BAEL-905 Improvement task for spring boot testing * BAEL-905 Improvement task for spring boot testing * BAEL-926 Upgrade Junit 5 dependencies to use M4
1 parent 2c23aa6 commit 1e6f0da

4 files changed

Lines changed: 7 additions & 10 deletions

File tree

‎junit5/pom.xml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
<properties>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
<java.version>1.8</java.version>
16-
<junit.jupiter.version>5.0.0-M3</junit.jupiter.version>
17-
<junit.platform.version>1.0.0-M3</junit.platform.version>
18-
16+
<junit.jupiter.version>5.0.0-M4</junit.jupiter.version>
17+
<junit.platform.version>1.0.0-M4</junit.platform.version>
18+
1919
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
2020
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
2121
</properties>
@@ -51,6 +51,5 @@
5151
<version>${junit.jupiter.version}</version>
5252
<scope>test</scope>
5353
</dependency>
54-
5554
</dependencies>
5655
</project>

‎junit5/src/test/java/com/baeldung/AssertionTest.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.baeldung;
22

33
import static org.junit.jupiter.api.Assertions.assertThrows;
4-
import static org.junit.jupiter.api.Assertions.expectThrows;
54

65
import org.junit.jupiter.api.Test;
76

@@ -10,7 +9,7 @@ public class AssertionTest {
109
@Test
1110
public void testConvertToDoubleThrowException() {
1211
String age = "eighteen";
13-
expectThrows(NumberFormatException.class, () -> {
12+
assertThrows(NumberFormatException.class, () -> {
1413
convertToInt(age);
1514
});
1615

‎junit5/src/test/java/com/baeldung/ExceptionTest.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
44
import static org.junit.jupiter.api.Assertions.assertThrows;
5-
import static org.junit.jupiter.api.Assertions.expectThrows;
65

76
import org.junit.jupiter.api.Test;
87

98
public class ExceptionTest {
109

1110
@Test
1211
void shouldThrowException() {
13-
Throwable exception = expectThrows(UnsupportedOperationException.class, () -> {
12+
Throwable exception = assertThrows(UnsupportedOperationException.class, () -> {
1413
throw new UnsupportedOperationException("Not supported");
1514
});
1615
assertEquals(exception.getMessage(), "Not supported");

‎junit5/src/test/java/com/baeldung/NestedTest.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ void isEmpty() {
3737
@Test
3838
@DisplayName("throws EmptyStackException when popped")
3939
void throwsExceptionWhenPopped() {
40-
Assertions.expectThrows(EmptyStackException.class, () -> stack.pop());
40+
Assertions.assertThrows(EmptyStackException.class, () -> stack.pop());
4141
}
4242

4343
@Test
4444
@DisplayName("throws EmptyStackException when peeked")
4545
void throwsExceptionWhenPeeked() {
46-
Assertions.expectThrows(EmptyStackException.class, () -> stack.peek());
46+
Assertions.assertThrows(EmptyStackException.class, () -> stack.peek());
4747
}
4848

4949
@Nested

0 commit comments

Comments
 (0)