From 1e6f0da46ac1c624d7f74e9f7eaea4a3f1910f8d Mon Sep 17 00:00:00 2001 From: Yasin Date: Sun, 7 May 2017 23:11:55 +0530 Subject: [PATCH] BAEL-926 Upgrade Junit 5 dependencies to use M4 (#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 --- junit5/pom.xml | 7 +++---- junit5/src/test/java/com/baeldung/AssertionTest.java | 3 +-- junit5/src/test/java/com/baeldung/ExceptionTest.java | 3 +-- junit5/src/test/java/com/baeldung/NestedTest.java | 4 ++-- 4 files changed, 7 insertions(+), 10 deletions(-) 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