What I have right now
I have a 3rd party singleton instance that my class under test relies on and that singleton is using System.getenv(String)
in its constructor. Is it possible to mock this call?
I tried this
JMockIt Example
new Expectations()
{
System mockedSystem;
{
System.getenv( "FISSK_CONFIG_HOME" ); returns( "." );
}
};
But it gives me an EXCEPTION_ACCESS_VIOLATION
and crashes the JVM.
Is there another way to set a system environment variable for a unit test?