diff --git a/junit5/pom.xml b/junit5/pom.xml
index 14aa51dbe2..3994bf12d6 100644
--- a/junit5/pom.xml
+++ b/junit5/pom.xml
@@ -13,9 +13,9 @@
UTF-8
1.8
- 5.0.0-M3
- 1.0.0-M3
-
+ 5.0.0-M4
+ 1.0.0-M4
+
3.6.0
2.19.1
@@ -51,6 +51,5 @@
${junit.jupiter.version}
test
-
\ No newline at end of file
diff --git a/junit5/src/test/java/com/baeldung/AssertionTest.java b/junit5/src/test/java/com/baeldung/AssertionTest.java
index 70297b9073..1bb543556b 100644
--- a/junit5/src/test/java/com/baeldung/AssertionTest.java
+++ b/junit5/src/test/java/com/baeldung/AssertionTest.java
@@ -1,7 +1,6 @@
package com.baeldung;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.expectThrows;
import org.junit.jupiter.api.Test;
@@ -10,7 +9,7 @@ public class AssertionTest {
@Test
public void testConvertToDoubleThrowException() {
String age = "eighteen";
- expectThrows(NumberFormatException.class, () -> {
+ assertThrows(NumberFormatException.class, () -> {
convertToInt(age);
});
diff --git a/junit5/src/test/java/com/baeldung/ExceptionTest.java b/junit5/src/test/java/com/baeldung/ExceptionTest.java
index 31a6dff657..f4567c6c15 100644
--- a/junit5/src/test/java/com/baeldung/ExceptionTest.java
+++ b/junit5/src/test/java/com/baeldung/ExceptionTest.java
@@ -2,7 +2,6 @@ package com.baeldung;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.expectThrows;
import org.junit.jupiter.api.Test;
@@ -10,7 +9,7 @@ public class ExceptionTest {
@Test
void shouldThrowException() {
- Throwable exception = expectThrows(UnsupportedOperationException.class, () -> {
+ Throwable exception = assertThrows(UnsupportedOperationException.class, () -> {
throw new UnsupportedOperationException("Not supported");
});
assertEquals(exception.getMessage(), "Not supported");
diff --git a/junit5/src/test/java/com/baeldung/NestedTest.java b/junit5/src/test/java/com/baeldung/NestedTest.java
index b1c873e258..963d75c5b7 100644
--- a/junit5/src/test/java/com/baeldung/NestedTest.java
+++ b/junit5/src/test/java/com/baeldung/NestedTest.java
@@ -37,13 +37,13 @@ public class NestedTest {
@Test
@DisplayName("throws EmptyStackException when popped")
void throwsExceptionWhenPopped() {
- Assertions.expectThrows(EmptyStackException.class, () -> stack.pop());
+ Assertions.assertThrows(EmptyStackException.class, () -> stack.pop());
}
@Test
@DisplayName("throws EmptyStackException when peeked")
void throwsExceptionWhenPeeked() {
- Assertions.expectThrows(EmptyStackException.class, () -> stack.peek());
+ Assertions.assertThrows(EmptyStackException.class, () -> stack.peek());
}
@Nested