diff options
author | Allon Mureinik <mureinik@gmail.com> | 2018-10-02 06:41:37 +0300 |
---|---|---|
committer | pascalschumacher <pascalschumacher@gmx.net> | 2018-10-06 10:02:58 +0200 |
commit | 729adb624d3e720afb8686093814ab2bcc2d2f13 (patch) | |
tree | 3e044ad58a27159d8f9cc815b3ef2a7af3c0431c /src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java | |
parent | 90d8b93efd8331aa3a246bb542cab82ef99207b9 (diff) | |
download | apache-commons-lang-729adb624d3e720afb8686093814ab2bcc2d2f13.tar.gz |
Update builder tests to JUnit Jupiter
Upgrade the tests in the builder package to use JUnit Jupiter as part of
the effort to remove the dependency on the Vintage Engine.
While most of these changes are drop-in replacements with no functional
benefit, it is worth mentioning the change to how expected exceptions
are tested.
Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an
"expected" argument. Instead, an explicit call to
org.junit.jupiter.api.Assertions.assertThrows is used. This call allows
the test to pinpoint the exact statement that is expected to throw the
expcetion and allows making the tests a bit stricter by preventing
false-positives that could occur if the setup code would throw the
expected exception instead of the statement that was supposed to throw
it.
Diffstat (limited to 'src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java')
-rw-r--r-- | src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java index d46dd6d18..8cb2ff539 100644 --- a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java @@ -16,14 +16,14 @@ */ package org.apache.commons.lang3.builder; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; import java.util.HashMap; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Unit tests {@link org.apache.commons.lang3.builder.RecursiveToStringStyleTest}. @@ -33,12 +33,12 @@ public class RecursiveToStringStyleTest { private final Integer base = Integer.valueOf(5); private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base)); - @Before + @BeforeEach public void setUp() throws Exception { ToStringBuilder.setDefaultStyle(new RecursiveToStringStyle()); } - @After + @AfterEach public void tearDown() throws Exception { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } |