You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by sg...@apache.org on 2009/02/23 21:49:39 UTC
svn commit: r747132 -
/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
Author: sgoeschl
Date: Mon Feb 23 20:49:37 2009
New Revision: 747132
URL: http://svn.apache.org/viewvc?rev=747132&view=rev
Log:
Minor javadoc improvements ....
Modified:
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java?rev=747132&r1=747131&r2=747132&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Mon Feb 23 20:49:37 2009
@@ -31,21 +31,20 @@
public class EnvironmentUtilTest extends TestCase {
+ /**
+ * Tests the behaviour of the EnvironmentUtils.toStrings()
+ * when using a <code>null</code> environment.
+ */
public void testToStrings() {
+ // check for a non-existing environment when passing null
TestUtil.assertEquals(null, EnvironmentUtils.toStrings(null), false);
-
+ // check for an environment when filling in two variables
Map env = new HashMap();
-
TestUtil.assertEquals(new String[0], EnvironmentUtils.toStrings(env), false);
-
env.put("foo2", "bar2");
env.put("foo", "bar");
-
String[] envStrings = EnvironmentUtils.toStrings(env);
-
String[] expected = new String[]{"foo=bar", "foo2=bar2"};
-
-
TestUtil.assertEquals(expected, envStrings, false);
}
@@ -57,7 +56,7 @@
public void testGetProcEnvironment() throws IOException {
Map procEnvironment = EnvironmentUtils.getProcEnvironment();
// we assume that there is at least one environment variable
- // for this process
+ // for this process, i.e. $JAVA_HOME
assertTrue(procEnvironment.size() > 0);
String[] envArgs = EnvironmentUtils.toStrings(procEnvironment);
for(int i=0; i<envArgs.length; i++) {
@@ -94,7 +93,13 @@
assertEquals("bar", procEnvironment.get("Foo"));
assertEquals("bar", procEnvironment.get("foo"));
}
-
+
+ /**
+ * Accessing environment variables is case-sensitive or not depending
+ * on the operating system but the values of the environment variable
+ * are always case-sensitive. So make sure that this assumption holds
+ * on all operating systems.
+ */
public void testCaseInsensitiveVariableLookup() throws Exception {
Map procEnvironment = EnvironmentUtils.getProcEnvironment();
// Check that case is preserved for values