Tests should not have side effects on their test environment. Failing to reset modified Java system properties can cause other tests to fail. Modified Java system properties should be restored by the time the test has completed.

Example:

public class MyTest {
    @Before
    public void setUp() {
        // prepare environment for test
        System.setProperty;
    }

    @After
    public void tearDown() {
        // restore original environment
        System.setProperty;
    }
}
  • No labels