/** * Decides if the operating system matches. * * @param osNamePrefix the prefix for the OS name * @return true if matches, or false if not or can't determine */ private static boolean getOsMatchesName(final String osNamePrefix) { return isOSNameMatch(OS_NAME, osNamePrefix); }
/** * 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 testOSMatchesName() { String osName = null; assertFalse(SystemUtils.isOSNameMatch(osName, "Windows")); osName = ""; assertFalse(SystemUtils.isOSNameMatch(osName, "Windows")); osName = "Windows 95"; assertTrue(SystemUtils.isOSNameMatch(osName, "Windows")); osName = "Windows NT"; assertTrue(SystemUtils.isOSNameMatch(osName, "Windows")); osName = "OS/2"; assertFalse(SystemUtils.isOSNameMatch(osName, "Windows")); }
/** * Decides if the operating system matches. * * @param osNamePrefix the prefix for the OS name * @return true if matches, or false if not or can't determine */ private static boolean getOsMatchesName(final String osNamePrefix) { return isOSNameMatch(OS_NAME, osNamePrefix); }
/** * Decides if the operating system matches. * * @param osNamePrefix the prefix for the OS name * @return true if matches, or false if not or can't determine */ private static boolean getOsMatchesName(final String osNamePrefix) { return isOSNameMatch(OS_NAME, osNamePrefix); }
/** * Decides if the operating system matches. * * @param osNamePrefix the prefix for the OS name * @return true if matches, or false if not or can't determine */ private static boolean getOsMatchesName(final String osNamePrefix) { return isOSNameMatch(OS_NAME, osNamePrefix); }
/** * 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); }