@Test public void parseOSName() { String old = System.getProperty("os.name"); try { System.setProperty("os.name", "windows7"); Assert.assertTrue(SystemInfo.parseOSName()[0]); System.setProperty("os.name", "linux123"); Assert.assertTrue(SystemInfo.parseOSName()[1]); System.setProperty("os.name", "mac osx123"); Assert.assertTrue(SystemInfo.parseOSName()[2]); } finally { if (old == null) { System.clearProperty("os.name"); } else { System.setProperty("os.name", old); } } }
@VisibleForTesting static boolean[] parseOSName() { boolean[] result = new boolean[] { false, false, false }; String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("windows")) { result[0] = true; } else if (osName.contains("linux")) { result[1] = true; } else if (osName.contains("mac")) { result[2] = true; } return result; }
SystemInfo { @VisibleForTesting static boolean[] parseOSName() { boolean[] result = new boolean[] { false, false, false }; String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("windows")) { result[0] = true; } else if (osName.contains("linux")) { result[1] = true; } else if (osName.contains("mac")) { result[2] = true; } return result; } }
SystemInfo { @VisibleForTesting static boolean[] parseOSName() { boolean[] result = new boolean[] { false, false, false }; String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("windows")) { result[0] = true; } else if (osName.contains("linux")) { result[1] = true; } else if (osName.contains("mac")) { result[2] = true; } return result; }  }
SystemInfo { @VisibleForTesting static boolean[] parseOSName() { boolean[] result = new boolean[] { false, false, false }; String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("windows")) { result[0] = true; } else if (osName.contains("linux")) { result[1] = true; } else if (osName.contains("mac")) { result[2] = true; } return result; }  static boolean isWindows(); static Boolean isLinux(); static boolean isMac(); static int getCpuCores(); static String getLocalHost(); static void setLocalHost(String localhost); static String getHostMachine(); }
SystemInfo { @VisibleForTesting static boolean[] parseOSName() { boolean[] result = new boolean[] { false, false, false }; String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("windows")) { result[0] = true; } else if (osName.contains("linux")) { result[1] = true; } else if (osName.contains("mac")) { result[2] = true; } return result; }  static boolean isWindows(); static Boolean isLinux(); static boolean isMac(); static int getCpuCores(); static String getLocalHost(); static void setLocalHost(String localhost); static String getHostMachine();  }