Home How to test OS-specific method with JUnit?
 I would like to test the following method with JUnit: private static boolean systemIsWindows() { String os = System.getProperty("os.name").toLowerCase(); return os.startsWith("win"); }  Frankly, the only thing I've come up with is to basically copy to same logic to the test. This would, of course, protect against the method being inadvertently broken, but sounds somehow counter-intuitive. What would be a better way to test this method?