1 19 20 package com.sslexplorer.agent.client.util; 21 22 import static org.junit.Assert.assertFalse; 23 import static org.junit.Assert.assertTrue; 24 25 import org.junit.Test; 26 27 public class UtilsTest { 28 29 @Test 30 public void testIsSupportedJREGreatherThan() { 31 System.setProperty("java.version", "1.4"); 32 assertTrue("1.3 supported by 1.4", Utils.isSupportedJRE("+1.3")); 33 assertTrue("1.4 supported by 1.4", Utils.isSupportedJRE("+1.4")); 34 assertFalse("1.4.5 not supported by 1.4", Utils.isSupportedJRE("+1.4.5")); 35 assertFalse("1.5 not supported by 1.4", Utils.isSupportedJRE("+1.5")); 36 assertFalse("1.5.0 not supported by 1.4", Utils.isSupportedJRE("+1.5.0")); 37 38 System.setProperty("java.version", "1.1.1"); 39 assertTrue("1.0 is supported by 1.1.1", Utils.isSupportedJRE("+1.0")); 40 assertTrue("1.1.1 supported by 1.1.1", Utils.isSupportedJRE("1.1.1")); 41 assertTrue("1.1.1 supported by 1.1.1", Utils.isSupportedJRE("+1.1.1")); 42 assertFalse("1.1.2 not supported by 1.1.1", Utils.isSupportedJRE("+1.1.2")); 43 assertFalse("1.4.5 not supported by 1.1.1", Utils.isSupportedJRE("+1.4.5")); 44 } 45 46 @Test 47 public void testIsSupportedJRELessThan() { 48 System.setProperty("java.version", "1.4"); 49 assertFalse("-1.3 not supported by 1.4", Utils.isSupportedJRE("-1.3")); 50 assertTrue("-1.4 supported by 1.4", Utils.isSupportedJRE("-1.4")); 51 assertTrue("-1.5 supported by 1.4", Utils.isSupportedJRE("-1.5")); 52 53 System.setProperty("java.version", "1.1.4"); 54 assertTrue("-1.3 not supported by 1.1.4", Utils.isSupportedJRE("-1.3")); 55 assertFalse("+1.3 not supported by 1.1.4", Utils.isSupportedJRE("+1.3")); 56 } 57 58 @Test 59 public void testIsSupportedOSVersionLessThan() { 60 System.setProperty("os.version", "6.0"); 61 assertFalse("-5.0 not supported by 6.0", Utils.isSupportedOSVersion("-5.0")); 62 assertFalse("-5.9 not supported by 6.0", Utils.isSupportedOSVersion("-5.9")); 63 assertTrue("6.0 supported by 6.0", Utils.isSupportedOSVersion("-6.0")); 64 assertTrue("6.1 supported by 6.0", Utils.isSupportedOSVersion("-6.1")); 65 } 66 } 67 | Popular Tags |