diff --git a/pom.xml b/pom.xml
index fe76882b9ba..b2ba4e66761 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,12 +82,6 @@
5.4.0
test
-
- org.mockito
- mockito-core
- 4.11.0
- test
-
org.apache.commons
diff --git a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
index 609aa0ce1f5..b70cf247e6d 100644
--- a/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharEncodingTest.java
@@ -28,9 +28,9 @@
/**
* Tests CharEncoding.
*
- * @see CharEncoding
+ * @deprecated this test can be removed once the deprecated source class {@link org.apache.commons.lang3.CharEncoding} is removed.
*/
-@SuppressWarnings("deprecation")
+@Deprecated
public class CharEncodingTest extends AbstractLangTest {
private void assertSupportedEncoding(final String name) {
diff --git a/src/test/java/org/apache/commons/lang3/FunctionsTest.java b/src/test/java/org/apache/commons/lang3/FunctionsTest.java
index a8c1a420222..e6a81fcd855 100644
--- a/src/test/java/org/apache/commons/lang3/FunctionsTest.java
+++ b/src/test/java/org/apache/commons/lang3/FunctionsTest.java
@@ -45,6 +45,12 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
+/**
+ * Tests Functions.
+ *
+ * @deprecated this test can be removed once the deprecated source class {@link org.apache.commons.lang3.Functions} is removed.
+ */
+@Deprecated
public class FunctionsTest extends AbstractLangTest {
public static class CloseableObject {
diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
index 0f6d43212d6..27cc60f2043 100644
--- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
@@ -19,6 +19,7 @@
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -792,7 +793,7 @@ public void testNotEqual() {
public void testNull() {
assertNotNull(ObjectUtils.NULL);
// 1 Check that NULL really is a Null i.e. the definition has not been changed
- assertTrue(ObjectUtils.NULL instanceof ObjectUtils.Null);
+ assertInstanceOf(ObjectUtils.Null.class, ObjectUtils.NULL);
assertSame(ObjectUtils.NULL, SerializationUtils.clone(ObjectUtils.NULL));
}
diff --git a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
index 3c0e0f5cc35..124696b992d 100644
--- a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
@@ -23,7 +23,6 @@
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -533,7 +532,7 @@ public void testRandomApis(final RandomStringUtils rsu) {
assertEquals(50, r1.length(), "random(50) length");
String r2 = rsu.next(50);
assertEquals(50, r2.length(), "random(50) length");
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
r1 = rsu.nextAscii(50);
assertEquals(50, r1.length(), "randomAscii(50) length");
@@ -541,7 +540,7 @@ public void testRandomApis(final RandomStringUtils rsu) {
assertThat("char >= 32 && <= 127", (int) r1.charAt(i), allOf(greaterThanOrEqualTo(32), lessThanOrEqualTo(127)));
}
r2 = rsu.nextAscii(50);
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
r1 = rsu.nextAlphabetic(50);
assertEquals(50, r1.length(), "randomAlphabetic(50)");
@@ -549,7 +548,7 @@ public void testRandomApis(final RandomStringUtils rsu) {
assertTrue(Character.isLetter(r1.charAt(i)) && !Character.isDigit(r1.charAt(i)), "r1 contains alphabetic");
}
r2 = rsu.nextAlphabetic(50);
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
r1 = rsu.nextAlphanumeric(50);
assertEquals(50, r1.length(), "randomAlphanumeric(50)");
@@ -557,7 +556,7 @@ public void testRandomApis(final RandomStringUtils rsu) {
assertTrue(Character.isLetterOrDigit(r1.charAt(i)), "r1 contains alphanumeric");
}
r2 = rsu.nextAlphabetic(50);
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
r1 = rsu.nextGraph(50);
assertEquals(50, r1.length(), "randomGraph(50) length");
@@ -565,7 +564,7 @@ public void testRandomApis(final RandomStringUtils rsu) {
assertTrue(r1.charAt(i) >= 33 && r1.charAt(i) <= 126, "char between 33 and 126");
}
r2 = rsu.nextGraph(50);
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
r1 = rsu.nextNumeric(50);
assertEquals(50, r1.length(), "randomNumeric(50)");
@@ -573,7 +572,7 @@ public void testRandomApis(final RandomStringUtils rsu) {
assertTrue(Character.isDigit(r1.charAt(i)) && !Character.isLetter(r1.charAt(i)), "r1 contains numeric");
}
r2 = rsu.nextNumeric(50);
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
r1 = rsu.nextPrint(50);
assertEquals(50, r1.length(), "randomPrint(50) length");
@@ -581,7 +580,7 @@ public void testRandomApis(final RandomStringUtils rsu) {
assertTrue(r1.charAt(i) >= 32 && r1.charAt(i) <= 126, "char between 32 and 126");
}
r2 = rsu.nextPrint(50);
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
String set = "abcdefg";
r1 = rsu.next(50, set);
@@ -590,13 +589,13 @@ public void testRandomApis(final RandomStringUtils rsu) {
assertTrue(set.indexOf(r1.charAt(i)) > -1, "random char in set");
}
r2 = rsu.next(50, set);
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
r1 = rsu.next(50, (String) null);
assertEquals(50, r1.length(), "random(50) length");
r2 = rsu.next(50, (String) null);
assertEquals(50, r2.length(), "random(50) length");
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
set = "stuvwxyz";
r1 = rsu.next(50, set.toCharArray());
@@ -605,13 +604,13 @@ public void testRandomApis(final RandomStringUtils rsu) {
assertTrue(set.indexOf(r1.charAt(i)) > -1, "random char in set");
}
r2 = rsu.next(50, set);
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
r1 = rsu.next(50, (char[]) null);
assertEquals(50, r1.length(), "random(50) length");
r2 = rsu.next(50, (char[]) null);
assertEquals(50, r2.length(), "random(50) length");
- assertFalse(r1.equals(r2), "!r1.equals(r2)");
+ assertNotEquals(r1, r2, "!r1.equals(r2)");
r1 = rsu.next(0);
assertEquals("", r1, "random(0).equals(\"\")");
diff --git a/src/test/java/org/apache/commons/lang3/StreamsTest.java b/src/test/java/org/apache/commons/lang3/StreamsTest.java
index dd64e557108..ee9a133dab3 100644
--- a/src/test/java/org/apache/commons/lang3/StreamsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StreamsTest.java
@@ -41,6 +41,12 @@
import org.junit.jupiter.api.function.Executable;
import org.xml.sax.SAXException;
+/**
+ * Tests Streams.
+ *
+ * @deprecated this test can be removed once the deprecated source class {@link org.apache.commons.lang3.Streams} is removed.
+ */
+@Deprecated
public class StreamsTest extends AbstractLangTest {
protected FailableConsumer asIntConsumer(final T pThrowable) {
diff --git a/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java b/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java
index 1d1b025986d..cdefed95c4b 100644
--- a/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java
+++ b/src/test/java/org/apache/commons/lang3/exception/AbstractExceptionContextTest.java
@@ -18,6 +18,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -164,7 +165,7 @@ public void testSetContextValue() {
assertTrue(message.contains("Crap"));
assertNull(exceptionContext.getFirstContextValue("crap"));
- assertTrue(exceptionContext.getFirstContextValue("test Poorly written obj") instanceof ObjectWithFaultyToString);
+ assertInstanceOf(ObjectWithFaultyToString.class, exceptionContext.getFirstContextValue("test Poorly written obj"));
assertEquals(7, exceptionContext.getContextEntries().size());
assertEquals(6, exceptionContext.getContextLabels().size());
diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
index cf1bdf3270a..71a03debd22 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -18,6 +18,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -389,24 +390,24 @@ public void testCompareFloat() {
@SuppressWarnings("cast") // suppress instanceof warning check
@Test
public void testConstants() {
- assertTrue(NumberUtils.LONG_ZERO instanceof Long);
- assertTrue(NumberUtils.LONG_ONE instanceof Long);
- assertTrue(NumberUtils.LONG_MINUS_ONE instanceof Long);
- assertTrue(NumberUtils.INTEGER_ZERO instanceof Integer);
- assertTrue(NumberUtils.INTEGER_ONE instanceof Integer);
- assertTrue(NumberUtils.INTEGER_MINUS_ONE instanceof Integer);
- assertTrue(NumberUtils.SHORT_ZERO instanceof Short);
- assertTrue(NumberUtils.SHORT_ONE instanceof Short);
- assertTrue(NumberUtils.SHORT_MINUS_ONE instanceof Short);
- assertTrue(NumberUtils.BYTE_ZERO instanceof Byte);
- assertTrue(NumberUtils.BYTE_ONE instanceof Byte);
- assertTrue(NumberUtils.BYTE_MINUS_ONE instanceof Byte);
- assertTrue(NumberUtils.DOUBLE_ZERO instanceof Double);
- assertTrue(NumberUtils.DOUBLE_ONE instanceof Double);
- assertTrue(NumberUtils.DOUBLE_MINUS_ONE instanceof Double);
- assertTrue(NumberUtils.FLOAT_ZERO instanceof Float);
- assertTrue(NumberUtils.FLOAT_ONE instanceof Float);
- assertTrue(NumberUtils.FLOAT_MINUS_ONE instanceof Float);
+ assertInstanceOf(Long.class, NumberUtils.LONG_ZERO);
+ assertInstanceOf(Long.class, NumberUtils.LONG_ONE);
+ assertInstanceOf(Long.class, NumberUtils.LONG_MINUS_ONE);
+ assertInstanceOf(Integer.class, NumberUtils.INTEGER_ZERO);
+ assertInstanceOf(Integer.class, NumberUtils.INTEGER_ONE);
+ assertInstanceOf(Integer.class, NumberUtils.INTEGER_MINUS_ONE);
+ assertInstanceOf(Short.class, NumberUtils.SHORT_ZERO);
+ assertInstanceOf(Short.class, NumberUtils.SHORT_ONE);
+ assertInstanceOf(Short.class, NumberUtils.SHORT_MINUS_ONE);
+ assertInstanceOf(Byte.class, NumberUtils.BYTE_ZERO);
+ assertInstanceOf(Byte.class, NumberUtils.BYTE_ONE);
+ assertInstanceOf(Byte.class, NumberUtils.BYTE_MINUS_ONE);
+ assertInstanceOf(Double.class, NumberUtils.DOUBLE_ZERO);
+ assertInstanceOf(Double.class, NumberUtils.DOUBLE_ONE);
+ assertInstanceOf(Double.class, NumberUtils.DOUBLE_MINUS_ONE);
+ assertInstanceOf(Float.class, NumberUtils.FLOAT_ZERO);
+ assertInstanceOf(Float.class, NumberUtils.FLOAT_ONE);
+ assertInstanceOf(Float.class, NumberUtils.FLOAT_MINUS_ONE);
assertEquals(0, NumberUtils.LONG_ZERO.longValue());
assertEquals(1, NumberUtils.LONG_ONE.longValue());
@@ -1551,31 +1552,31 @@ public void testMinShort_nullArray() {
*/
@Test
public void testStringCreateNumberEnsureNoPrecisionLoss() {
- assertTrue(NumberUtils.createNumber("1.23") instanceof Float);
- assertTrue(NumberUtils.createNumber("3.40282354e+38") instanceof Double);
- assertTrue(NumberUtils.createNumber("1.797693134862315759e+308") instanceof BigDecimal);
+ assertInstanceOf(Float.class, NumberUtils.createNumber("1.23"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("3.40282354e+38"));
+ assertInstanceOf(BigDecimal.class, NumberUtils.createNumber("1.797693134862315759e+308"));
// LANG-1060
- assertTrue(NumberUtils.createNumber("001.12") instanceof Float);
- assertTrue(NumberUtils.createNumber("-001.12") instanceof Float);
- assertTrue(NumberUtils.createNumber("+001.12") instanceof Float);
- assertTrue(NumberUtils.createNumber("003.40282354e+38") instanceof Double);
- assertTrue(NumberUtils.createNumber("-003.40282354e+38") instanceof Double);
- assertTrue(NumberUtils.createNumber("+003.40282354e+38") instanceof Double);
- assertTrue(NumberUtils.createNumber("0001.797693134862315759e+308") instanceof BigDecimal);
- assertTrue(NumberUtils.createNumber("-001.797693134862315759e+308") instanceof BigDecimal);
- assertTrue(NumberUtils.createNumber("+001.797693134862315759e+308") instanceof BigDecimal);
+ assertInstanceOf(Float.class, NumberUtils.createNumber("001.12"));
+ assertInstanceOf(Float.class, NumberUtils.createNumber("-001.12"));
+ assertInstanceOf(Float.class, NumberUtils.createNumber("+001.12"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("003.40282354e+38"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("-003.40282354e+38"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("+003.40282354e+38"));
+ assertInstanceOf(BigDecimal.class, NumberUtils.createNumber("0001.797693134862315759e+308"));
+ assertInstanceOf(BigDecimal.class, NumberUtils.createNumber("-001.797693134862315759e+308"));
+ assertInstanceOf(BigDecimal.class, NumberUtils.createNumber("+001.797693134862315759e+308"));
//LANG-1613
- assertTrue(NumberUtils.createNumber("2.2250738585072014E-308") instanceof Double);
- assertTrue(NumberUtils.createNumber("2.2250738585072014E-308D") instanceof Double);
- assertTrue(NumberUtils.createNumber("2.2250738585072014E-308F") instanceof Double);
- assertTrue(NumberUtils.createNumber("4.9E-324") instanceof Double);
- assertTrue(NumberUtils.createNumber("4.9E-324D") instanceof Double);
- assertTrue(NumberUtils.createNumber("4.9E-324F") instanceof Double);
- assertTrue(NumberUtils.createNumber("1.7976931348623157E308") instanceof Double);
- assertTrue(NumberUtils.createNumber("1.7976931348623157E308D") instanceof Double);
- assertTrue(NumberUtils.createNumber("1.7976931348623157E308F") instanceof Double);
- assertTrue(NumberUtils.createNumber("4.9e-324D") instanceof Double);
- assertTrue(NumberUtils.createNumber("4.9e-324F") instanceof Double);
+ assertInstanceOf(Double.class, NumberUtils.createNumber("2.2250738585072014E-308"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("2.2250738585072014E-308D"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("2.2250738585072014E-308F"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("4.9E-324"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("4.9E-324D"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("4.9E-324F"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("1.7976931348623157E308"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("1.7976931348623157E308D"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("1.7976931348623157E308F"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("4.9e-324D"));
+ assertInstanceOf(Double.class, NumberUtils.createNumber("4.9e-324F"));
}
/**
diff --git a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
index 98eeb17dffe..cf68617e9b1 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java
@@ -19,6 +19,7 @@
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -83,7 +84,7 @@ private void callRemoveFinalModifierCheckForException(final Field field, final B
FieldUtils.removeFinalModifier(field, forceAccess);
} catch (final UnsupportedOperationException exception) {
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_12)) {
- assertTrue(exception.getCause() instanceof NoSuchFieldException);
+ assertInstanceOf(NoSuchFieldException.class, exception.getCause());
} else {
fail("No exception should be thrown for java prior to 12.0");
}
diff --git a/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java b/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
index a7d9bdf2687..0225d98ed2d 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrMatcherTest.java
@@ -18,8 +18,8 @@
package org.apache.commons.lang3.text;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertSame;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.commons.lang3.AbstractLangTest;
import org.junit.jupiter.api.Test;
@@ -56,7 +56,7 @@ public void testCharSetMatcher_charArray() {
assertEquals(0, matcher.isMatch(BUFFER2, 5));
assertSame(StrMatcher.noneMatcher(), StrMatcher.charSetMatcher());
assertSame(StrMatcher.noneMatcher(), StrMatcher.charSetMatcher((char[]) null));
- assertTrue(StrMatcher.charSetMatcher("a".toCharArray()) instanceof StrMatcher.CharMatcher);
+ assertInstanceOf(StrMatcher.CharMatcher.class, StrMatcher.charSetMatcher("a".toCharArray()));
}
@Test
@@ -70,7 +70,7 @@ public void testCharSetMatcher_String() {
assertEquals(0, matcher.isMatch(BUFFER2, 5));
assertSame(StrMatcher.noneMatcher(), StrMatcher.charSetMatcher(""));
assertSame(StrMatcher.noneMatcher(), StrMatcher.charSetMatcher((String) null));
- assertTrue(StrMatcher.charSetMatcher("a") instanceof StrMatcher.CharMatcher);
+ assertInstanceOf(StrMatcher.CharMatcher.class, StrMatcher.charSetMatcher("a"));
}
@Test
diff --git a/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java b/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
index 16f5e438ce0..5edc772afc9 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
@@ -19,6 +19,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -266,14 +267,14 @@ public void testGetSetEscape() {
@Test
public void testGetSetPrefix() {
final StrSubstitutor sub = new StrSubstitutor();
- assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher);
+ assertInstanceOf(StrMatcher.StringMatcher.class, sub.getVariablePrefixMatcher());
sub.setVariablePrefix('<');
- assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.CharMatcher);
+ assertInstanceOf(StrMatcher.CharMatcher.class, sub.getVariablePrefixMatcher());
sub.setVariablePrefix("<<");
- assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher);
+ assertInstanceOf(StrMatcher.StringMatcher.class, sub.getVariablePrefixMatcher());
assertThrows(NullPointerException.class, () -> sub.setVariablePrefix(null));
- assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher);
+ assertInstanceOf(StrMatcher.StringMatcher.class, sub.getVariablePrefixMatcher());
final StrMatcher matcher = StrMatcher.commaMatcher();
sub.setVariablePrefixMatcher(matcher);
@@ -288,14 +289,14 @@ public void testGetSetPrefix() {
@Test
public void testGetSetSuffix() {
final StrSubstitutor sub = new StrSubstitutor();
- assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher);
+ assertInstanceOf(StrMatcher.StringMatcher.class, sub.getVariableSuffixMatcher());
sub.setVariableSuffix('<');
- assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.CharMatcher);
+ assertInstanceOf(StrMatcher.CharMatcher.class, sub.getVariableSuffixMatcher());
sub.setVariableSuffix("<<");
- assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher);
+ assertInstanceOf(StrMatcher.StringMatcher.class, sub.getVariableSuffixMatcher());
assertThrows(NullPointerException.class, () -> sub.setVariableSuffix(null));
- assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher);
+ assertInstanceOf(StrMatcher.StringMatcher.class, sub.getVariableSuffixMatcher());
final StrMatcher matcher = StrMatcher.commaMatcher();
sub.setVariableSuffixMatcher(matcher);
@@ -310,12 +311,12 @@ public void testGetSetSuffix() {
@Test
public void testGetSetValueDelimiter() {
final StrSubstitutor sub = new StrSubstitutor();
- assertTrue(sub.getValueDelimiterMatcher() instanceof StrMatcher.StringMatcher);
+ assertInstanceOf(StrMatcher.StringMatcher.class, sub.getValueDelimiterMatcher());
sub.setValueDelimiter(':');
- assertTrue(sub.getValueDelimiterMatcher() instanceof StrMatcher.CharMatcher);
+ assertInstanceOf(StrMatcher.CharMatcher.class, sub.getValueDelimiterMatcher());
sub.setValueDelimiter("||");
- assertTrue(sub.getValueDelimiterMatcher() instanceof StrMatcher.StringMatcher);
+ assertInstanceOf(StrMatcher.StringMatcher.class, sub.getValueDelimiterMatcher());
sub.setValueDelimiter(null);
assertNull(sub.getValueDelimiterMatcher());
diff --git a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java
index 37cdf5e97bb..ebf753bab65 100644
--- a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java
+++ b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java
@@ -197,17 +197,17 @@ public String setValue(final String value) {
return null;
}
};
- assertTrue(pair.equals(entry));
+ assertEquals(pair, entry);
assertEquals(pair.hashCode(), entry.hashCode());
- assertTrue(pair.equals(entry2));
+ assertEquals(pair, entry2);
assertEquals(pair.hashCode(), entry2.hashCode());
- assertTrue(entry.equals(entry));
+ assertEquals(entry, entry);
assertEquals(entry.hashCode(), entry.hashCode());
- assertTrue(entry2.equals(entry2));
+ assertEquals(entry2, entry2);
assertEquals(entry2.hashCode(), entry2.hashCode());
- assertTrue(entry.equals(entry2));
+ assertEquals(entry, entry2);
assertEquals(entry.hashCode(), entry2.hashCode());
- assertTrue(entry.equals(pair));
+ assertEquals(entry, pair);
assertEquals(entry.hashCode(), pair.hashCode());
}
@@ -225,7 +225,7 @@ public void testFormattable_simple() {
}
@ParameterizedTest()
- @MethodSource("org.apache.commons.lang3.tuple.PairTest#mapClassFactory()")
+ @MethodSource("org.apache.commons.lang3.tuple.PairTest#mapClassFactory")
public void testMapEntries(final Class