ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From umag...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/util JavaEnvUtilsTest.java
Date Mon, 08 Apr 2002 18:08:08 GMT
umagesh     02/04/08 11:08:08

  Modified:    src/testcases/org/apache/tools/ant/util
                        JavaEnvUtilsTest.java
  Log:
  Move assertion statement inside try block and make the testcase pass on Windows environments
with dubious java.home
  
  Revision  Changes    Path
  1.2       +12 -12    jakarta-ant/src/testcases/org/apache/tools/ant/util/JavaEnvUtilsTest.java
  
  Index: JavaEnvUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/util/JavaEnvUtilsTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaEnvUtilsTest.java	28 Mar 2002 12:15:27 -0000	1.1
  +++ JavaEnvUtilsTest.java	8 Apr 2002 18:08:08 -0000	1.2
  @@ -82,7 +82,7 @@
       public void testGetExecutableWindows() {
           if (Os.isFamily("windows")) {
               FileUtils fileUtils = FileUtils.newFileUtils();
  -            String javaHome = 
  +            String javaHome =
                   fileUtils.normalize(System.getProperty("java.home"))
                   .getAbsolutePath();
   
  @@ -96,16 +96,16 @@
                   // java.home is bogus
                   assertEquals("java.exe", j);
               }
  -            
  +
               j = JavaEnvUtils.getJdkExecutable("javac");
               assertTrue(j.endsWith(".exe"));
  -            assertTrue(j+" is absolute", (new File(j)).isAbsolute());
               try {
  -                String javaHomeParent = 
  +                assertTrue(j+" is absolute", (new File(j)).isAbsolute());
  +                String javaHomeParent =
                       fileUtils.normalize(javaHome+"/..").getAbsolutePath();
                   assertTrue(j+" is normalized and in the JDK dir",
                              j.startsWith(javaHomeParent));
  -                
  +
                   if (JavaEnvUtils.getJavaVersion() == JavaEnvUtils.JAVA_1_0 ||
                       JavaEnvUtils.getJavaVersion() == JavaEnvUtils.JAVA_1_1) {
                       assertTrue(j+" is normalized and in the JRE dir",
  @@ -114,12 +114,12 @@
                       assertTrue(j+" is normalized and not in the JRE dir",
                                  !j.startsWith(javaHome));
                   }
  -                
  +
               } catch (AssertionFailedError e) {
                   // java.home is bogus
                   assertEquals("javac.exe", j);
               }
  -            
  +
               assertEquals("foo.exe", JavaEnvUtils.getJreExecutable("foo"));
               assertEquals("foo.exe", JavaEnvUtils.getJdkExecutable("foo"));
           }
  @@ -128,7 +128,7 @@
       public void testGetExecutableMostPlatforms() {
           if (!Os.isName("netware") && !Os.isFamily("windows")) {
               FileUtils fileUtils = FileUtils.newFileUtils();
  -            String javaHome = 
  +            String javaHome =
                   fileUtils.normalize(System.getProperty("java.home"))
                   .getAbsolutePath();
   
  @@ -149,7 +149,7 @@
               }
               assertTrue(j+" is absolute", (new File(j)).isAbsolute());
   
  -            String javaHomeParent = 
  +            String javaHomeParent =
                   fileUtils.normalize(javaHome+"/..").getAbsolutePath();
               assertTrue(j+" is normalized and in the JDK dir",
                          j.startsWith(javaHomeParent));
  @@ -163,12 +163,12 @@
                              !j.startsWith(javaHome));
               }
   
  -            assertEquals("foo"+extension, 
  +            assertEquals("foo"+extension,
                            JavaEnvUtils.getJreExecutable("foo"));
  -            assertEquals("foo"+extension, 
  +            assertEquals("foo"+extension,
                            JavaEnvUtils.getJdkExecutable("foo"));
           }
  -        
  +
       }
   
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message