This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-text.git
commit a78023d2782b40dd1f9b1fe719fe1f5eac5f8851 Author: Gary Gregory <[email protected]> AuthorDate: Fri Dec 12 14:23:11 2025 -0500 Use static imports only for JUnit assertions --- .../text/lookup/Base64DecoderStringLookupTest.java | 11 +++++++---- .../text/lookup/Base64EncoderStringLookupTest.java | 11 +++++++---- .../text/lookup/BiFunctionStringLookupTest.java | 21 ++++++++++++--------- .../commons/text/lookup/BiStringLookupTest.java | 5 +++-- .../text/lookup/ConstantStringLookupBasicTest.java | 15 +++++++++------ .../text/lookup/ConstantStringLookupTest.java | 20 +++++++++++--------- .../commons/text/lookup/DateStringLookupTest.java | 4 ++-- .../commons/text/lookup/DnsStringLookupTest.java | 20 ++++++++++++-------- .../lookup/EnvironmentVariableStringLookupTest.java | 13 ++++++++----- .../commons/text/lookup/FileStringLookupTest.java | 15 ++++++++------- .../text/lookup/FunctionStringLookupTest.java | 15 +++++++++------ .../InetAddressStringLookupLocalHostTest.java | 18 +++++++++++------- .../InetAddressStringLookupLoopbackAddressTest.java | 18 +++++++++++------- .../text/lookup/InterpolatorStringLookupTest.java | 5 ++--- .../text/lookup/JavaPlatformStringLookupTest.java | 7 ++++--- .../commons/text/lookup/NullStringLookupTest.java | 10 ++++++---- .../text/lookup/PropertiesStringLookupTest.java | 19 ++++++++++--------- .../text/lookup/ResourceBundleStringLookupTest.java | 11 ++++++----- .../commons/text/lookup/ScriptStringLookupTest.java | 15 +++++++++------ .../text/lookup/SystemPropertyStringLookupTest.java | 11 +++++++---- .../text/lookup/UrlDecoderStringLookupTest.java | 14 ++++++++------ .../text/lookup/UrlEncoderStringLookupTest.java | 10 ++++++---- .../commons/text/lookup/UrlStringLookupTest.java | 15 +++++++++------ .../text/lookup/XmlDecoderStringLookupTest.java | 11 +++++++---- .../text/lookup/XmlEncoderStringLookupTest.java | 11 +++++++---- 25 files changed, 191 insertions(+), 134 deletions(-) diff --git a/src/test/java/org/apache/commons/text/lookup/Base64DecoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/Base64DecoderStringLookupTest.java index c5eac76e..99cbeeaa 100644 --- a/src/test/java/org/apache/commons/text/lookup/Base64DecoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/Base64DecoderStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -27,18 +30,18 @@ class Base64DecoderStringLookupTest { @Test void test() { - Assertions.assertEquals("HelloWorld!", StringLookupFactory.INSTANCE_BASE64_DECODER.apply("SGVsbG9Xb3JsZCE=")); + assertEquals("HelloWorld!", StringLookupFactory.INSTANCE_BASE64_DECODER.apply("SGVsbG9Xb3JsZCE=")); } @Test void testNull() { - Assertions.assertNull(StringLookupFactory.INSTANCE_BASE64_DECODER.apply(null)); + assertNull(StringLookupFactory.INSTANCE_BASE64_DECODER.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_BASE64_DECODER.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_BASE64_DECODER.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/Base64EncoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/Base64EncoderStringLookupTest.java index df4d320d..b6741bb0 100644 --- a/src/test/java/org/apache/commons/text/lookup/Base64EncoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/Base64EncoderStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -27,18 +30,18 @@ class Base64EncoderStringLookupTest { @Test void test() { - Assertions.assertEquals("SGVsbG9Xb3JsZCE=", StringLookupFactory.INSTANCE_BASE64_ENCODER.apply("HelloWorld!")); + assertEquals("SGVsbG9Xb3JsZCE=", StringLookupFactory.INSTANCE_BASE64_ENCODER.apply("HelloWorld!")); } @Test void testNull() { - Assertions.assertNull(StringLookupFactory.INSTANCE_BASE64_ENCODER.apply(null)); + assertNull(StringLookupFactory.INSTANCE_BASE64_ENCODER.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_BASE64_ENCODER.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_BASE64_ENCODER.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/BiFunctionStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/BiFunctionStringLookupTest.java index e6f9337a..e73f64f7 100644 --- a/src/test/java/org/apache/commons/text/lookup/BiFunctionStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/BiFunctionStringLookupTest.java @@ -17,13 +17,16 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiFunction; import org.apache.commons.lang3.StringUtils; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -71,25 +74,25 @@ class BiFunctionStringLookupTest { // Use map final BiStringLookup<Map<String, Object>> stringLookup = StringLookupFactory.INSTANCE .biFunctionStringLookup(nestedMapBiFunction); - Assertions.assertEquals(rootValue2, stringLookup.lookup(rootKey2, rootMap)); - Assertions.assertEquals(subValue, stringLookup.lookup(rootKey + SEPARATOR + subKey, rootMap)); - Assertions.assertEquals(subSubValue, + assertEquals(rootValue2, stringLookup.lookup(rootKey2, rootMap)); + assertEquals(subValue, stringLookup.lookup(rootKey + SEPARATOR + subKey, rootMap)); + assertEquals(subSubValue, stringLookup.lookup(rootKey + SEPARATOR + subKeyMap + SEPARATOR + subSubKey, rootMap)); } @Test void testConcurrentHashMapNull() { - Assertions.assertNull(BiFunctionStringLookup.on(new ConcurrentHashMap<>()).apply(null)); + assertNull(BiFunctionStringLookup.on(new ConcurrentHashMap<>()).apply(null)); } @Test void testHashMapNull() { - Assertions.assertNull(BiFunctionStringLookup.on(new HashMap<>()).apply(null)); + assertNull(BiFunctionStringLookup.on(new HashMap<>()).apply(null)); } @Test void testNullBiFunction() { - Assertions.assertNull(BiFunctionStringLookup.on((BiFunction<String, Object, Object>) null).apply(null)); + assertNull(BiFunctionStringLookup.on((BiFunction<String, Object, Object>) null).apply(null)); } @Test @@ -98,13 +101,13 @@ class BiFunctionStringLookupTest { final String value = "value"; final Map<String, String> map = new HashMap<>(); map.put(key, value); - Assertions.assertEquals(value, FunctionStringLookup.on(map).apply(key)); + assertEquals(value, FunctionStringLookup.on(map).apply(key)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(BiFunctionStringLookup.on(new HashMap<>()).toString().isEmpty()); + assertFalse(BiFunctionStringLookup.on(new HashMap<>()).toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java index 5aee02ab..a54b35db 100644 --- a/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java @@ -17,7 +17,8 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.junit.jupiter.api.Test; /** @@ -27,7 +28,7 @@ class BiStringLookupTest { @Test void testDefaultMethod() { - Assertions.assertEquals("a", ((BiStringLookup<Object>) key -> key).lookup("a", "b")); + assertEquals("a", ((BiStringLookup<Object>) key -> key).lookup("a", "b")); } } diff --git a/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupBasicTest.java b/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupBasicTest.java index f3a4bbfe..d438abac 100644 --- a/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupBasicTest.java +++ b/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupBasicTest.java @@ -17,8 +17,11 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -55,12 +58,12 @@ class ConstantStringLookupBasicTest { @Test void testNull() { - Assertions.assertNull(ConstantStringLookup.INSTANCE.apply(null)); + assertNull(ConstantStringLookup.INSTANCE.apply(null)); } @Test void testNullClassFetch() { - Assertions.assertNull(new ConstantStringLookup() { + assertNull(new ConstantStringLookup() { @Override protected Class<?> fetchClass(final String className) throws ClassNotFoundException { return null; @@ -70,20 +73,20 @@ class ConstantStringLookupBasicTest { @Test void testNullValue() { - Assertions.assertEquals(NULL_STRING_FIXTURE, ConstantStringLookup.INSTANCE + assertEquals(NULL_STRING_FIXTURE, ConstantStringLookup.INSTANCE .apply(ConstantStringLookupBasicTest.class.getName() + ".NULL_STRING_FIXTURE")); } @Test void testOne() { - Assertions.assertEquals(STRING_FIXTURE, + assertEquals(STRING_FIXTURE, ConstantStringLookup.INSTANCE.apply(ConstantStringLookupBasicTest.class.getName() + ".STRING_FIXTURE")); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(ConstantStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(ConstantStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupTest.java index 49d252ac..fccc45d7 100644 --- a/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/ConstantStringLookupTest.java @@ -16,10 +16,12 @@ */ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + import java.awt.event.KeyEvent; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -71,7 +73,7 @@ class ConstantStringLookupTest { */ @Test void testLookupConstant() { - Assertions.assertEquals(FIELD, stringLookup.apply(variable("FIELD")), "Wrong value of constant"); + assertEquals(FIELD, stringLookup.apply(variable("FIELD")), "Wrong value of constant"); } /** @@ -79,7 +81,7 @@ class ConstantStringLookupTest { */ @Test void testLookupInvalidSyntax() { - Assertions.assertNull(stringLookup.apply("InvalidVariableName"), + assertNull(stringLookup.apply("InvalidVariableName"), "Non null return value for invalid variable name"); } @@ -88,7 +90,7 @@ class ConstantStringLookupTest { */ @Test void testLookupNonExisting() { - Assertions.assertNull(stringLookup.apply(variable("NO_FIELD")), + assertNull(stringLookup.apply(variable("NO_FIELD")), "Non null return value for non existing constant"); } @@ -99,8 +101,8 @@ class ConstantStringLookupTest { void testLookupNonString() { final String ref = KeyEvent.class.getName() + ".VK_ESCAPE"; final String expected = Integer.toString(KeyEvent.VK_ESCAPE); - Assertions.assertEquals(expected, stringLookup.apply(ref), "Wrong result of first lookup"); - Assertions.assertEquals(expected, stringLookup.apply(ref), "Wrong result of 2nd lookup"); + assertEquals(expected, stringLookup.apply(ref), "Wrong result of first lookup"); + assertEquals(expected, stringLookup.apply(ref), "Wrong result of 2nd lookup"); } /** @@ -108,7 +110,7 @@ class ConstantStringLookupTest { */ @Test void testLookupNull() { - Assertions.assertNull(stringLookup.apply(null), "Non null return value for null variable"); + assertNull(stringLookup.apply(null), "Non null return value for null variable"); } /** @@ -116,7 +118,7 @@ class ConstantStringLookupTest { */ @Test void testLookupPrivate() { - Assertions.assertNull(stringLookup.apply(variable("PRIVATE_FIELD")), + assertNull(stringLookup.apply(variable("PRIVATE_FIELD")), "Non null return value for non accessible field"); } @@ -125,7 +127,7 @@ class ConstantStringLookupTest { */ @Test void testLookupUnknownClass() { - Assertions.assertNull(stringLookup.apply("org.apache.commons.configuration.NonExistingConfig." + FIELD), + assertNull(stringLookup.apply("org.apache.commons.configuration.NonExistingConfig." + FIELD), "Non null return value for unknown class"); } diff --git a/src/test/java/org/apache/commons/text/lookup/DateStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/DateStringLookupTest.java index cd358a34..e09e8aa5 100644 --- a/src/test/java/org/apache/commons/text/lookup/DateStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/DateStringLookupTest.java @@ -18,6 +18,7 @@ package org.apache.commons.text.lookup; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -26,7 +27,6 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -62,7 +62,7 @@ class DateStringLookupTest { @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(DateStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(DateStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java index c1ce322b..b62dee6a 100644 --- a/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/DnsStringLookupTest.java @@ -17,10 +17,14 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.net.InetAddress; import java.net.UnknownHostException; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -31,28 +35,28 @@ class DnsStringLookupTest { @Test void testAddressFromHostAddress() throws UnknownHostException { final InetAddress localHost = InetAddress.getLocalHost(); - Assertions.assertEquals(localHost.getHostAddress(), + assertEquals(localHost.getHostAddress(), DnsStringLookup.INSTANCE.apply("address|" + localHost.getHostAddress())); } @Test void testAddressFromHostName() throws UnknownHostException { final InetAddress localHost = InetAddress.getLocalHost(); - Assertions.assertEquals(localHost.getHostAddress(), + assertEquals(localHost.getHostAddress(), DnsStringLookup.INSTANCE.apply("address|" + localHost.getHostName())); } @Test void testCanonicalNameFromHostAddress() throws UnknownHostException { final InetAddress localHost = InetAddress.getLocalHost(); - Assertions.assertEquals(localHost.getCanonicalHostName(), + assertEquals(localHost.getCanonicalHostName(), DnsStringLookup.INSTANCE.apply("canonical-name|" + localHost.getHostAddress())); } @Test void testCanonicalNameFromHostName() throws UnknownHostException { final InetAddress localHost = InetAddress.getLocalHost(); - Assertions.assertEquals(localHost.getCanonicalHostName(), + assertEquals(localHost.getCanonicalHostName(), DnsStringLookup.INSTANCE.apply("canonical-name|" + localHost.getHostName())); } @@ -66,18 +70,18 @@ class DnsStringLookupTest { matched = true; } } - Assertions.assertTrue(matched); + assertTrue(matched); } @Test void testNull() { - Assertions.assertNull(DnsStringLookup.INSTANCE.apply(null)); + assertNull(DnsStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(DnsStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(DnsStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/EnvironmentVariableStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/EnvironmentVariableStringLookupTest.java index 2dd79808..346adf15 100644 --- a/src/test/java/org/apache/commons/text/lookup/EnvironmentVariableStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/EnvironmentVariableStringLookupTest.java @@ -17,8 +17,11 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.apache.commons.lang3.SystemUtils; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -28,24 +31,24 @@ class EnvironmentVariableStringLookupTest { @Test void testNull() { - Assertions.assertNull(StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(null)); + assertNull(StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(null)); } @Test void testOne() { if (SystemUtils.IS_OS_WINDOWS) { final String key = "PATH"; - Assertions.assertEquals(System.getenv(key), StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(key)); + assertEquals(System.getenv(key), StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(key)); } else if (SystemUtils.IS_OS_LINUX) { final String key = "USER"; - Assertions.assertEquals(System.getenv(key), StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(key)); + assertEquals(System.getenv(key), StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.apply(key)); } } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_ENVIRONMENT_VARIABLES.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java index acfaae7a..d87be3ae 100644 --- a/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/FileStringLookupTest.java @@ -18,6 +18,8 @@ package org.apache.commons.text.lookup; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; @@ -28,7 +30,6 @@ import java.nio.file.Paths; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringSubstitutor; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -44,7 +45,7 @@ public class FileStringLookupTest { } public static void testFence(final String expectedString, final FileStringLookup fileStringLookup) { - Assertions.assertEquals(expectedString, fileStringLookup.apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); + assertEquals(expectedString, fileStringLookup.apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); assertThrows(IllegalArgumentException.class, () -> fileStringLookup.apply("UTF-8:/src/test/resources/org/apache/commons/text/document.properties")); assertThrows(IllegalArgumentException.class, () -> fileStringLookup.apply("UTF-8:../src/test/resources/org/apache/commons/text/document.properties")); } @@ -73,19 +74,19 @@ public class FileStringLookupTest { @Test void testDefaultInstanceNull() { - Assertions.assertNull(FileStringLookup.INSTANCE.apply(null)); + assertNull(FileStringLookup.INSTANCE.apply(null)); } @Test void testDefaultInstanceOne() throws Exception { final String expectedString = readDocumentFixtureString(); - Assertions.assertEquals(expectedString, FileStringLookup.INSTANCE.apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); + assertEquals(expectedString, FileStringLookup.INSTANCE.apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); } @Test void testDefaultInstanceToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(FileStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(FileStringLookup.INSTANCE.toString().isEmpty()); } @Test @@ -120,13 +121,13 @@ public class FileStringLookupTest { @Test void testFenceEmptyOne() throws Exception { final String expectedString = readDocumentFixtureString(); - Assertions.assertEquals(expectedString, new FileStringLookup().apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); + assertEquals(expectedString, new FileStringLookup().apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); } @Test void testFenceNullOne() throws Exception { final String expectedString = readDocumentFixtureString(); - Assertions.assertEquals(expectedString, + assertEquals(expectedString, new FileStringLookup((Path[]) null).apply("UTF-8:src/test/resources/org/apache/commons/text/document.properties")); } diff --git a/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java index c9f29733..92ff7ac3 100644 --- a/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java @@ -17,12 +17,15 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -32,17 +35,17 @@ class FunctionStringLookupTest { @Test void testConcurrentHashMapNull() { - Assertions.assertNull(FunctionStringLookup.on(new ConcurrentHashMap<>()).apply(null)); + assertNull(FunctionStringLookup.on(new ConcurrentHashMap<>()).apply(null)); } @Test void testHashMapNull() { - Assertions.assertNull(FunctionStringLookup.on(new HashMap<>()).apply(null)); + assertNull(FunctionStringLookup.on(new HashMap<>()).apply(null)); } @Test void testNullFunction() { - Assertions.assertNull(FunctionStringLookup.on((Function<String, Object>) null).apply(null)); + assertNull(FunctionStringLookup.on((Function<String, Object>) null).apply(null)); } @Test @@ -51,13 +54,13 @@ class FunctionStringLookupTest { final String value = "value"; final Map<String, String> map = new HashMap<>(); map.put(key, value); - Assertions.assertEquals(value, FunctionStringLookup.on(map).apply(key)); + assertEquals(value, FunctionStringLookup.on(map).apply(key)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(FunctionStringLookup.on(new HashMap<>()).toString().isEmpty()); + assertFalse(FunctionStringLookup.on(new HashMap<>()).toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLocalHostTest.java b/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLocalHostTest.java index 762f1062..8f2aad3c 100644 --- a/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLocalHostTest.java +++ b/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLocalHostTest.java @@ -17,10 +17,14 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + import java.net.InetAddress; import java.net.UnknownHostException; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -30,33 +34,33 @@ class InetAddressStringLookupLocalHostTest { @Test void testAddress() throws UnknownHostException { - Assertions.assertEquals(InetAddress.getLocalHost().getHostAddress(), InetAddressStringLookup.LOCAL_HOST.apply("address")); + assertEquals(InetAddress.getLocalHost().getHostAddress(), InetAddressStringLookup.LOCAL_HOST.apply("address")); } @Test void testBadKey() { - Assertions.assertThrows(IllegalArgumentException.class, () -> InetAddressStringLookup.LOCAL_HOST.apply("FOO")); + assertThrows(IllegalArgumentException.class, () -> InetAddressStringLookup.LOCAL_HOST.apply("FOO")); } @Test void testCanonicalName() throws UnknownHostException { - Assertions.assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), InetAddressStringLookup.LOCAL_HOST.apply("canonical-name")); + assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), InetAddressStringLookup.LOCAL_HOST.apply("canonical-name")); } @Test void testName() throws UnknownHostException { - Assertions.assertEquals(InetAddress.getLocalHost().getHostName(), InetAddressStringLookup.LOCAL_HOST.apply("name")); + assertEquals(InetAddress.getLocalHost().getHostName(), InetAddressStringLookup.LOCAL_HOST.apply("name")); } @Test void testNull() { - Assertions.assertNull(InetAddressStringLookup.LOCAL_HOST.apply(null)); + assertNull(InetAddressStringLookup.LOCAL_HOST.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(InetAddressStringLookup.LOCAL_HOST.toString().isEmpty()); + assertFalse(InetAddressStringLookup.LOCAL_HOST.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLoopbackAddressTest.java b/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLoopbackAddressTest.java index 282ea6dc..b69c002e 100644 --- a/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLoopbackAddressTest.java +++ b/src/test/java/org/apache/commons/text/lookup/InetAddressStringLookupLoopbackAddressTest.java @@ -17,9 +17,13 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + import java.net.InetAddress; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -29,33 +33,33 @@ class InetAddressStringLookupLoopbackAddressTest { @Test void testAddress() { - Assertions.assertEquals(InetAddress.getLoopbackAddress().getHostAddress(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("address")); + assertEquals(InetAddress.getLoopbackAddress().getHostAddress(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("address")); } @Test void testBadKey() { - Assertions.assertThrows(IllegalArgumentException.class, () -> InetAddressStringLookup.LOOPACK_ADDRESS.apply("FOO")); + assertThrows(IllegalArgumentException.class, () -> InetAddressStringLookup.LOOPACK_ADDRESS.apply("FOO")); } @Test void testCanonicalName() { - Assertions.assertEquals(InetAddress.getLoopbackAddress().getCanonicalHostName(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("canonical-name")); + assertEquals(InetAddress.getLoopbackAddress().getCanonicalHostName(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("canonical-name")); } @Test void testName() { - Assertions.assertEquals(InetAddress.getLoopbackAddress().getHostName(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("name")); + assertEquals(InetAddress.getLoopbackAddress().getHostName(), InetAddressStringLookup.LOOPACK_ADDRESS.apply("name")); } @Test void testNull() { - Assertions.assertNull(InetAddressStringLookup.LOOPACK_ADDRESS.apply(null)); + assertNull(InetAddressStringLookup.LOOPACK_ADDRESS.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(InetAddressStringLookup.LOOPACK_ADDRESS.toString().isEmpty()); + assertFalse(InetAddressStringLookup.LOOPACK_ADDRESS.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/InterpolatorStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/InterpolatorStringLookupTest.java index 6b49df48..631538a6 100644 --- a/src/test/java/org/apache/commons/text/lookup/InterpolatorStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/InterpolatorStringLookupTest.java @@ -27,7 +27,6 @@ import java.util.HashMap; import java.util.Map; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -115,12 +114,12 @@ class InterpolatorStringLookupTest { @Test void testNull() { - Assertions.assertNull(InterpolatorStringLookup.INSTANCE.apply(null)); + assertNull(InterpolatorStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(new InterpolatorStringLookup().toString().isEmpty()); + assertFalse(new InterpolatorStringLookup().toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/JavaPlatformStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/JavaPlatformStringLookupTest.java index 759e4d5c..3f081653 100644 --- a/src/test/java/org/apache/commons/text/lookup/JavaPlatformStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/JavaPlatformStringLookupTest.java @@ -17,11 +17,12 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.commons.lang3.ArrayUtils; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -41,13 +42,13 @@ class JavaPlatformStringLookupTest { @Test void testNull() { - Assertions.assertNull(JavaPlatformStringLookup.INSTANCE.apply(null)); + assertNull(JavaPlatformStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(JavaPlatformStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(JavaPlatformStringLookup.INSTANCE.toString().isEmpty()); } @Test diff --git a/src/test/java/org/apache/commons/text/lookup/NullStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/NullStringLookupTest.java index 2612de2d..768d894d 100644 --- a/src/test/java/org/apache/commons/text/lookup/NullStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/NullStringLookupTest.java @@ -17,7 +17,9 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -27,14 +29,14 @@ class NullStringLookupTest { @Test void test() { - Assertions.assertNull(StringLookupFactory.INSTANCE_NULL.apply("EverythingIsNull")); - Assertions.assertNull(StringLookupFactory.INSTANCE_NULL.apply(null)); + assertNull(StringLookupFactory.INSTANCE_NULL.apply("EverythingIsNull")); + assertNull(StringLookupFactory.INSTANCE_NULL.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_NULL.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_NULL.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/PropertiesStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/PropertiesStringLookupTest.java index a9a3f86f..9991056e 100644 --- a/src/test/java/org/apache/commons/text/lookup/PropertiesStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/PropertiesStringLookupTest.java @@ -18,6 +18,8 @@ package org.apache.commons.text.lookup; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import java.nio.file.Path; @@ -27,7 +29,6 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringSubstitutor; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -131,10 +132,10 @@ public class PropertiesStringLookupTest { @Test void testNull() { - Assertions.assertNull(PropertiesStringLookup.INSTANCE.apply(null)); - Assertions.assertNull(new PropertiesStringLookup().apply(null)); - Assertions.assertNull(new PropertiesStringLookup(NULL_PATH_ARRAY).apply(null)); - Assertions.assertNull(new PropertiesStringLookup(CURRENT_PATH).apply(null)); + assertNull(PropertiesStringLookup.INSTANCE.apply(null)); + assertNull(new PropertiesStringLookup().apply(null)); + assertNull(new PropertiesStringLookup(NULL_PATH_ARRAY).apply(null)); + assertNull(new PropertiesStringLookup(CURRENT_PATH).apply(null)); } @Test @@ -149,10 +150,10 @@ public class PropertiesStringLookupTest { @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(PropertiesStringLookup.INSTANCE.toString().isEmpty()); - Assertions.assertFalse(new PropertiesStringLookup().toString().isEmpty()); - Assertions.assertFalse(new PropertiesStringLookup(NULL_PATH_ARRAY).toString().isEmpty()); - Assertions.assertFalse(new PropertiesStringLookup(CURRENT_PATH).toString().isEmpty()); + assertFalse(PropertiesStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(new PropertiesStringLookup().toString().isEmpty()); + assertFalse(new PropertiesStringLookup(NULL_PATH_ARRAY).toString().isEmpty()); + assertFalse(new PropertiesStringLookup(CURRENT_PATH).toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/ResourceBundleStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/ResourceBundleStringLookupTest.java index b3721f24..21520a89 100644 --- a/src/test/java/org/apache/commons/text/lookup/ResourceBundleStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/ResourceBundleStringLookupTest.java @@ -17,6 +17,8 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.spy; @@ -24,7 +26,6 @@ import static org.mockito.Mockito.when; import java.util.ResourceBundle; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -39,7 +40,7 @@ class ResourceBundleStringLookupTest { void testAny() { final String bundleName = TEST_RESOURCE_BUNDLE; final String bundleKey = KEY; - Assertions.assertEquals(ResourceBundle.getBundle(bundleName).getString(bundleKey), + assertEquals(ResourceBundle.getBundle(bundleName).getString(bundleKey), ResourceBundleStringLookup.INSTANCE.apply(AbstractStringLookup.toLookupKey(bundleName, bundleKey))); } @@ -77,19 +78,19 @@ class ResourceBundleStringLookupTest { @Test void testNull() { - Assertions.assertNull(ResourceBundleStringLookup.INSTANCE.apply(null)); + assertNull(ResourceBundleStringLookup.INSTANCE.apply(null)); } @Test void testOne() { - Assertions.assertEquals(ResourceBundle.getBundle(TEST_RESOURCE_BUNDLE).getString(KEY), + assertEquals(ResourceBundle.getBundle(TEST_RESOURCE_BUNDLE).getString(KEY), new ResourceBundleStringLookup(TEST_RESOURCE_BUNDLE).apply(KEY)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(ResourceBundleStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(ResourceBundleStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/ScriptStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/ScriptStringLookupTest.java index 92e41896..d61987c3 100644 --- a/src/test/java/org/apache/commons/text/lookup/ScriptStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/ScriptStringLookupTest.java @@ -17,11 +17,14 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import javax.script.ScriptEngineManager; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -48,17 +51,17 @@ class ScriptStringLookupTest { @Test void testNull() { - Assertions.assertNull(ScriptStringLookup.INSTANCE.apply(null)); + assertNull(ScriptStringLookup.INSTANCE.apply(null)); } @Test void testOne() { - Assertions.assertEquals("Hello World!", ScriptStringLookup.INSTANCE.apply(JS_NAME + ":\"Hello World!\"")); + assertEquals("Hello World!", ScriptStringLookup.INSTANCE.apply(JS_NAME + ":\"Hello World!\"")); } @Test void testSanityCheck() { - Assertions.assertNotNull(new ScriptEngineManager().getEngineByName(JS_NAME), JS_NAME); + assertNotNull(new ScriptEngineManager().getEngineByName(JS_NAME), JS_NAME); } @Test @@ -68,14 +71,14 @@ class ScriptStringLookupTest { @Test void testScriptUsingMultipleColons() { - Assertions.assertEquals("It Works", + assertEquals("It Works", ScriptStringLookup.INSTANCE.apply(JS_NAME + ":true ? \"It Works\" : \"It Does Not Work\" ")); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(ScriptStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(ScriptStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/SystemPropertyStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/SystemPropertyStringLookupTest.java index 84ae67e2..7e71681e 100644 --- a/src/test/java/org/apache/commons/text/lookup/SystemPropertyStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/SystemPropertyStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -27,19 +30,19 @@ class SystemPropertyStringLookupTest { @Test void testNull() { - Assertions.assertNull(StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.apply(null)); + assertNull(StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.toString().isEmpty()); + assertFalse(StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.toString().isEmpty()); } @Test void testUserName() { final String key = "user.name"; - Assertions.assertEquals(System.getProperty(key), StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.apply(key)); + assertEquals(System.getProperty(key), StringLookupFactory.INSTANCE_SYSTEM_PROPERTIES.apply(key)); } } diff --git a/src/test/java/org/apache/commons/text/lookup/UrlDecoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/UrlDecoderStringLookupTest.java index b0a87bb5..a6b218b8 100644 --- a/src/test/java/org/apache/commons/text/lookup/UrlDecoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/UrlDecoderStringLookupTest.java @@ -17,6 +17,9 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -24,7 +27,6 @@ import static org.mockito.Mockito.when; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -36,7 +38,7 @@ class UrlDecoderStringLookupTest { @Test void testAllPercent() { - Assertions.assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello%20World%21")); + assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello%20World%21")); } @Test @@ -49,23 +51,23 @@ class UrlDecoderStringLookupTest { @Test void testExclamation() { - Assertions.assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello%20World!")); + assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello%20World!")); } @Test void testNull() { - Assertions.assertNull(UrlDecoderStringLookup.INSTANCE.apply(null)); + assertNull(UrlDecoderStringLookup.INSTANCE.apply(null)); } @Test void testPlus() { - Assertions.assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello+World!")); + assertEquals(DATA, UrlDecoderStringLookup.INSTANCE.apply("Hello+World!")); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(UrlDecoderStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(UrlDecoderStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/UrlEncoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/UrlEncoderStringLookupTest.java index 0b4eb757..4805d094 100644 --- a/src/test/java/org/apache/commons/text/lookup/UrlEncoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/UrlEncoderStringLookupTest.java @@ -17,6 +17,9 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -24,7 +27,6 @@ import static org.mockito.Mockito.when; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -36,7 +38,7 @@ class UrlEncoderStringLookupTest { @Test void test() { - Assertions.assertEquals(DATA, UrlEncoderStringLookup.INSTANCE.apply("Hello World!")); + assertEquals(DATA, UrlEncoderStringLookup.INSTANCE.apply("Hello World!")); } @Test @@ -49,13 +51,13 @@ class UrlEncoderStringLookupTest { @Test void testNull() { - Assertions.assertNull(UrlEncoderStringLookup.INSTANCE.apply(null)); + assertNull(UrlEncoderStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(UrlEncoderStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(UrlEncoderStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java index e69fb60d..916e67cf 100644 --- a/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java @@ -17,6 +17,10 @@ package org.apache.commons.text.lookup; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import java.net.URI; @@ -25,7 +29,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -55,13 +58,13 @@ class UrlStringLookupTest { // System.out.println(uri); final byte[] expectedBytes = Files.readAllBytes(path); final String expectedString = new String(expectedBytes, StandardCharsets.UTF_8); - Assertions.assertEquals(expectedString, UrlStringLookup.INSTANCE.apply("UTF-8:" + uri.toString())); + assertEquals(expectedString, UrlStringLookup.INSTANCE.apply("UTF-8:" + uri.toString())); } @Test void testHttpScheme() { - Assertions.assertNotNull(UrlStringLookup.INSTANCE.apply("UTF-8:https://www.apache.org")); - Assertions.assertNotNull(UrlStringLookup.INSTANCE.apply("UTF-8:https://www.google.com")); + assertNotNull(UrlStringLookup.INSTANCE.apply("UTF-8:https://www.apache.org")); + assertNotNull(UrlStringLookup.INSTANCE.apply("UTF-8:https://www.google.com")); } @Test @@ -71,13 +74,13 @@ class UrlStringLookupTest { @Test void testNull() { - Assertions.assertNull(UrlStringLookup.INSTANCE.apply(null)); + assertNull(UrlStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(UrlStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(UrlStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/XmlDecoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/XmlDecoderStringLookupTest.java index d378f596..117c6f38 100644 --- a/src/test/java/org/apache/commons/text/lookup/XmlDecoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/XmlDecoderStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -29,18 +32,18 @@ class XmlDecoderStringLookupTest { @Test void testDecode() { - Assertions.assertEquals(DATA, XmlDecoderStringLookup.INSTANCE.apply("<element>")); + assertEquals(DATA, XmlDecoderStringLookup.INSTANCE.apply("<element>")); } @Test void testNull() { - Assertions.assertNull(XmlDecoderStringLookup.INSTANCE.apply(null)); + assertNull(XmlDecoderStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(XmlDecoderStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(XmlDecoderStringLookup.INSTANCE.toString().isEmpty()); } } diff --git a/src/test/java/org/apache/commons/text/lookup/XmlEncoderStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/XmlEncoderStringLookupTest.java index b597fc14..219cd6ed 100644 --- a/src/test/java/org/apache/commons/text/lookup/XmlEncoderStringLookupTest.java +++ b/src/test/java/org/apache/commons/text/lookup/XmlEncoderStringLookupTest.java @@ -17,7 +17,10 @@ package org.apache.commons.text.lookup; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; + import org.junit.jupiter.api.Test; /** @@ -29,18 +32,18 @@ class XmlEncoderStringLookupTest { @Test void testDecode() { - Assertions.assertEquals(DATA, XmlEncoderStringLookup.INSTANCE.apply("<element>")); + assertEquals(DATA, XmlEncoderStringLookup.INSTANCE.apply("<element>")); } @Test void testNull() { - Assertions.assertNull(XmlEncoderStringLookup.INSTANCE.apply(null)); + assertNull(XmlEncoderStringLookup.INSTANCE.apply(null)); } @Test void testToString() { // does not blow up and gives some kind of string. - Assertions.assertFalse(XmlEncoderStringLookup.INSTANCE.toString().isEmpty()); + assertFalse(XmlEncoderStringLookup.INSTANCE.toString().isEmpty()); } }
