webcompere/system-stubs

How to Fake an absent environment variable

Closed this issue · 4 comments

I have a scenario where I need to test the code behavious in the absense of an environment variable. Unfortunity in my CI servers, this environmnet variable is set , and therefore accesssible via System.getEnv(). I am trying to test the scenario where the Environment variable does not exist? How can I do it with this library?

@warlockza Will setting the variables to blank string work? And what does your test class look like? Or are there loads?

@warlockza - the solution I expect to use is to set the environment variable to blank within SystemStubs - please respond if that's not going to work for you with a worked example test case. I'll close this in a couple of days if I do not hear back.

Solved in v2.1.5 with remove