webcompere / system-stubs

System Stubs - Test Doubles for Java System resources
MIT License
91 stars 10 forks source link

`ProcessBuilder.environment` is not influenced by the mock environment #40

Closed ashleyfrieze closed 2 years ago

ashleyfrieze commented 2 years ago

From a comment left at https://github.com/junit-pioneer/junit-pioneer/issues/509#issuecomment-1023401764

The mocking of ProcessEnvironment was slightly incomplete.

ashleyfrieze commented 2 years ago

To go into more detail here, the launching of a new process is supposed to gain the current environment variables when .environment() is used as part of process builder. This was automatic in the days where we were hacking into the underlying Map of the environment variables, but needs further intercepts and mocking when we use Mockito to get in the way of the ProcessEnvironment calls.