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-lang.git
commit 9f894c6385afe4003b645abbc9a32cfcef753646 Author: Gary Gregory <[email protected]> AuthorDate: Wed Jun 25 08:40:54 2025 -0400 Add org.apache.commons.lang3.SystemPropertiesTest.testGetProperty() --- .../apache/commons/lang3/SystemPropertiesTest.java | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/SystemPropertiesTest.java b/src/test/java/org/apache/commons/lang3/SystemPropertiesTest.java index 200ea871c..43824498d 100644 --- a/src/test/java/org/apache/commons/lang3/SystemPropertiesTest.java +++ b/src/test/java/org/apache/commons/lang3/SystemPropertiesTest.java @@ -33,8 +33,8 @@ class SystemPropertiesTest { - private static final String STRING_SPACE_1 = " "; - private static final String STRING_TAB_1 = "\t"; + private static final String KEY_SPACE_1 = " "; + private static final String KEY_TAB_1 = "\t"; private void basicKeyCheck(final String key) { assertNotNull(key); @@ -703,28 +703,37 @@ void testGetPathSeparator() { } @Test - @SetSystemProperties({ @SetSystemProperty(key = STRING_SPACE_1, value = "value1"), @SetSystemProperty(key = STRING_TAB_1, value = "value2") }) + @SetSystemProperties({ @SetSystemProperty(key = KEY_SPACE_1, value = "value1"), @SetSystemProperty(key = KEY_TAB_1, value = "value2") }) + void testGetProperty() { + assertNull(SystemProperties.getProperty(null)); + assertNull(SystemProperties.getProperty(StringUtils.EMPTY)); + assertEquals("value1", SystemProperties.getProperty(KEY_SPACE_1)); + assertEquals("value2", SystemProperties.getProperty(KEY_TAB_1)); + } + + @Test + @SetSystemProperties({ @SetSystemProperty(key = KEY_SPACE_1, value = "value1"), @SetSystemProperty(key = KEY_TAB_1, value = "value2") }) void testGetPropertyStringString() { assertNull(SystemProperties.getProperty(null, (String) null)); assertNull(SystemProperties.getProperty(StringUtils.EMPTY, (String) null)); - assertEquals("value1", SystemProperties.getProperty(STRING_SPACE_1, (String) null)); + assertEquals("value1", SystemProperties.getProperty(KEY_SPACE_1, (String) null)); assertEquals("value2", SystemProperties.getProperty("\t", (String) null)); assertEquals("x", SystemProperties.getProperty(null, "x")); assertEquals("x", SystemProperties.getProperty(StringUtils.EMPTY, "x")); - assertEquals("value1", SystemProperties.getProperty(STRING_SPACE_1, "v")); + assertEquals("value1", SystemProperties.getProperty(KEY_SPACE_1, "v")); assertEquals("value2", SystemProperties.getProperty("\t", "v")); } @Test - @SetSystemProperties({ @SetSystemProperty(key = STRING_SPACE_1, value = "value1"), @SetSystemProperty(key = STRING_TAB_1, value = "value2") }) + @SetSystemProperties({ @SetSystemProperty(key = KEY_SPACE_1, value = "value1"), @SetSystemProperty(key = KEY_TAB_1, value = "value2") }) void testGetPropertyStringSupplier() { assertNull(SystemProperties.getProperty(null, (Supplier<String>) null)); assertNull(SystemProperties.getProperty(StringUtils.EMPTY, (Supplier<String>) null)); - assertEquals("value1", SystemProperties.getProperty(STRING_SPACE_1, (Supplier<String>) null)); + assertEquals("value1", SystemProperties.getProperty(KEY_SPACE_1, (Supplier<String>) null)); assertEquals("value2", SystemProperties.getProperty("\t", (Supplier<String>) null)); assertEquals("x", SystemProperties.getProperty(null, () -> "x")); assertEquals("x", SystemProperties.getProperty(StringUtils.EMPTY, () -> "x")); - assertEquals("value1", SystemProperties.getProperty(STRING_SPACE_1, () -> "v")); + assertEquals("value1", SystemProperties.getProperty(KEY_SPACE_1, () -> "v")); assertEquals("value2", SystemProperties.getProperty("\t", () -> "v")); }
