@Test public void testWindowsVersionStringParsing() { String windowsVersionString = "5.1"; parseVersion(windowsVersionString); assertEquals(getOsMajorVersion(), 5); assertEquals(getOsMinorVersion(), 1); }
@Test public void testOSXVersionStringParsing() { String osXVersionString = "10.9.5"; parseVersion(osXVersionString); assertEquals(getOsMajorVersion(), 10); assertEquals(getOsMinorVersion(), 9); }
@Test public void testNoMinorVersionStringParsing() { String noMinorString = "100"; parseVersion(noMinorString); assertEquals(getOsMajorVersion(), 100); assertEquals(getOsMinorVersion(), 0); }
@Test public void testLinuxVersionStringParsing() { String linuxVersionString = "2.6.32-279.14.1.el6.x86_64"; parseVersion(linuxVersionString); assertEquals(getOsMajorVersion(), 2); assertEquals(getOsMinorVersion(), 6); }
@Test public void testAtLeast() { parseVersion("1.2.3"); assertTrue(atleast(OS_NAME, 1, 0)); assertTrue(atleast(OS_NAME, 1, 2)); assertFalse(atleast(OS_NAME, 1, 3)); assertFalse(atleast(OS_NAME, 2, 1)); assertFalse(atleast("iOS", 1, 0)); }
@Test public void testInvalidVersionStringParsing() { // The exception output will end up in the TestCase debug log under the // target/test-cases directory as set in the POM. String exceptionString = "abc.10"; parseVersion(exceptionString); assertEquals(getOsMajorVersion(), 0); assertEquals(getOsMinorVersion(), 0); }