Browse Source

Add testcase for sysproperty handling.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271365 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
14069410f1
1 changed files with 22 additions and 0 deletions
  1. +22
    -0
      src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java

+ 22
- 0
src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java View File

@@ -134,4 +134,26 @@ public class CommandlineJavaTest extends TestCase {
assertEquals("arg1", s[5]);
}

public void testSysproperties() {
String currentClasspath = System.getProperty("java.class.path");
assertNotNull(currentClasspath);
assertNull(System.getProperty("key"));
CommandlineJava c = new CommandlineJava();
Environment.Variable v = new Environment.Variable();
v.setKey("key");
v.setValue("value");
c.addSysproperty(v);
try {
c.setSystemProperties();
String newClasspath = System.getProperty("java.class.path");
assertNotNull(newClasspath);
assertEquals(currentClasspath, newClasspath);
assertNotNull(System.getProperty("key"));
assertEquals("value", System.getProperty("key"));
} finally {
c.restoreSystemProperties();
}
assertNull(System.getProperty("key"));
}

}

Loading…
Cancel
Save