Run unit tests only on Windows
Have you looked into assumptions? In the before method you can do this:
@Before
public void windowsOnly() {
org.junit.Assume.assumeTrue(isWindows());
}
Documentation: http://junit.sourceforge.net/javadoc/org/junit/Assume.html
In Junit5, There are options for configuring or run the test for specific Operating System.
@EnabledOnOs({ LINUX, MAC })
void onLinuxOrMac() {
}
@DisabledOnOs(WINDOWS)
void notOnWindows() {
// ...
}