1 7 package test.util; 8 9 import org.ejtools.util.Platform; 10 11 import junit.framework.TestCase; 12 13 17 public class PlatformTest extends TestCase 18 { 19 20 public PlatformTest() 21 { 22 super(); 23 } 24 25 26 31 public PlatformTest(String name) 32 { 33 super(name); 34 } 35 36 37 38 public void testJavaVersion() 39 { 40 assertEquals("Version is wrong", Platform.getJavaVersion(), "1.4.5"); 41 42 assertFalse("Version is not 1.1", Platform.IS_JAVA_1_1); 43 assertFalse("Version is not 1.2", Platform.IS_JAVA_1_2); 44 assertFalse("Version is not 1.3", Platform.IS_JAVA_1_3); 45 assertTrue("Version is not 1.4", Platform.IS_JAVA_1_4); 46 assertFalse("Version is not 1.5", Platform.IS_JAVA_1_5); 47 } 48 49 50 51 public void testJavaVersionCompatiblity() 52 { 53 assertTrue("Version is compatible with 1.1", Platform.isJavaVersionCompatible(Platform.JAVA_1_1)); 54 assertTrue("Version is compatible with 1.2", Platform.isJavaVersionCompatible(Platform.JAVA_1_2)); 55 assertTrue("Version is compatible with 1.3", Platform.isJavaVersionCompatible(Platform.JAVA_1_3)); 56 assertTrue("Version is compatible with 1.4", Platform.isJavaVersionCompatible(Platform.JAVA_1_4)); 57 assertFalse("Version is compatible with 1.5", Platform.isJavaVersionCompatible(Platform.JAVA_1_5)); 58 } 59 60 61 66 protected void setUp() 67 throws Exception 68 { 69 System.setProperty("java.version", "1.4.5"); 70 } 71 } 72 | Popular Tags |