stefanbirkner / system-rules

A collection of JUnit rules for testing code which uses java.lang.System.
http://stefanbirkner.github.io/system-rules
Other
546 stars 71 forks source link

EnvironmentVariables clear() does not work properly #86

Open serkan-ozkan opened 2 years ago

serkan-ozkan commented 2 years ago

I have a test dependent of environment variables. I am setting environment variable in @Before like this.

    @Rule
    public final EnvironmentVariables environmentVariables = new EnvironmentVariables();

@Before
    public void setUp() throws Exception {
        environmentVariables.set("someValue","testLink");
    }

In one of the test I need to clear the same environment variable. But when I do this:

environmentVariables.clear("someValue");

When I run the test alone it works fine but when I run all the tests in the class, environment variable is not cleared. Probably I am missin something but it can be a bug as well.