aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Gregory <garydgregory@gmail.com>2024-05-01 14:02:29 -0400
committerGary Gregory <garydgregory@gmail.com>2024-05-01 14:02:29 -0400
commit632c08534ca16259d91258d9f7d6bbeca430538b (patch)
tree4335c046eb5aecd66a77d1e5c83fdc00222641a8
parent9a313ed4607336e025ce34575fdb2006c709524f (diff)
downloadapache-commons-lang-upstream-master.tar.gz
Use SystemProperties in tests instead of magic string lookupsupstream-master
-rw-r--r--src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java7
1 files changed, 4 insertions, 3 deletions
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 7a565690e..16f5e438c 100644
--- a/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
@@ -29,6 +29,7 @@ import java.util.Map;
import java.util.Properties;
import org.apache.commons.lang3.AbstractLangTest;
+import org.apache.commons.lang3.SystemProperties;
import org.apache.commons.lang3.mutable.MutableObject;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@@ -670,11 +671,11 @@ public class StrSubstitutorTest extends AbstractLangTest {
@Test
public void testStaticReplaceSystemProperties() {
final StrBuilder buf = new StrBuilder();
- buf.append("Hi ").append(System.getProperty("user.name"));
+ buf.append("Hi ").append(SystemProperties.getUserName());
buf.append(", you are working with ");
- buf.append(System.getProperty("os.name"));
+ buf.append(SystemProperties.getOsName());
buf.append(", your home directory is ");
- buf.append(System.getProperty("user.home")).append('.');
+ buf.append(SystemProperties.getUserHome()).append('.');
assertEquals(buf.toString(), StrSubstitutor.replaceSystemProperties("Hi ${user.name}, you are "
+ "working with ${os.name}, your home "
+ "directory is ${user.home}."));