/** * Decides if the operating system matches. * <p> * This method is package private instead of private to support unit test invocation. * </p> * * @param osName the actual OS name * @param osVersion the actual OS version * @param osNamePrefix the prefix for the expected OS name * @param osVersionPrefix the prefix for the expected OS version * @return true if matches, or false if not or can't determine */ static boolean isOSMatch(final String osName, final String osVersion, final String osNamePrefix, final String osVersionPrefix) { if (osName == null || osVersion == null) { return false; } return isOSNameMatch(osName, osNamePrefix) && isOSVersionMatch(osVersion, osVersionPrefix); }
@Test public void testOsVersionMatches() throws Exception { String osVersion = null; assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.1")); assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.1")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.1")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.1.1")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.10")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.10.1")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.1")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.1.1")); assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.10")); assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.10.1")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.1")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.1.1")); assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.10")); assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.10.1")); assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.1")); assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.1.1")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.10")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.10.1")); assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.1")); assertFalse(SystemUtils.isOSVersionMatch(osVersion, "10.1.1")); assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.10"));
/** * Decides if the operating system matches. * <p> * This method is package private instead of private to support unit test invocation. * </p> * * @param osName the actual OS name * @param osVersion the actual OS version * @param osNamePrefix the prefix for the expected OS name * @param osVersionPrefix the prefix for the expected OS version * @return true if matches, or false if not or can't determine */ static boolean isOSMatch(final String osName, final String osVersion, final String osNamePrefix, final String osVersionPrefix) { if (osName == null || osVersion == null) { return false; } return isOSNameMatch(osName, osNamePrefix) && isOSVersionMatch(osVersion, osVersionPrefix); }
/** * Decides if the operating system matches. * <p> * This method is package private instead of private to support unit test invocation. * </p> * * @param osName the actual OS name * @param osVersion the actual OS version * @param osNamePrefix the prefix for the expected OS name * @param osVersionPrefix the prefix for the expected OS version * @return true if matches, or false if not or can't determine */ static boolean isOSMatch(final String osName, final String osVersion, final String osNamePrefix, final String osVersionPrefix) { if (osName == null || osVersion == null) { return false; } return isOSNameMatch(osName, osNamePrefix) && isOSVersionMatch(osVersion, osVersionPrefix); }
/** * Decides if the operating system matches. * <p> * This method is package private instead of private to support unit test invocation. * </p> * * @param osName the actual OS name * @param osVersion the actual OS version * @param osNamePrefix the prefix for the expected OS name * @param osVersionPrefix the prefix for the expected OS version * @return true if matches, or false if not or can't determine */ static boolean isOSMatch(final String osName, final String osVersion, final String osNamePrefix, final String osVersionPrefix) { if (osName == null || osVersion == null) { return false; } return isOSNameMatch(osName, osNamePrefix) && isOSVersionMatch(osVersion, osVersionPrefix); }