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/NoClassNameToStringStyleTest.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/NoClassNameToStringStyleTest.java')
-rw-r--r-- | src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java index 4865b034c..8c9c4ed07 100644 --- a/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java @@ -17,14 +17,14 @@ package org.apache.commons.lang3.builder; import org.apache.commons.lang3.builder.ToStringStyleTest.Person; -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; import java.util.ArrayList; import java.util.HashMap; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Unit tests {@link ToStringStyle#NO_CLASS_NAME_STYLE}. @@ -33,12 +33,12 @@ public class NoClassNameToStringStyleTest { private final Integer base = Integer.valueOf(5); - @Before + @BeforeEach public void setUp() throws Exception { ToStringBuilder.setDefaultStyle(ToStringStyle.NO_CLASS_NAME_STYLE); } - @After + @AfterEach public void tearDown() throws Exception { ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE); } |