I am trying to set the environment variables using the version 1.18.0 and I am always getting null. I am using Junit 5 and have no issues using 1.17.2 version to set the system environment variables. I need to set different environment values for different tests, so not setting the value right after creating the rule. My code looks like the following:
@Rule
private final EnvironmentVariables environmentVariables = new EnvironmentVariables();
@Test
void testEnvValues() {
environmentVariables.set("service_env", "dev");
assertEquals("dev", System.getenv("service_env")); // always fails
}
I am trying to set the environment variables using the version 1.18.0 and I am always getting null. I am using Junit 5 and have no issues using 1.17.2 version to set the system environment variables. I need to set different environment values for different tests, so not setting the value right after creating the rule. My code looks like the following: