I have a weird situation which is consequence of some poor design, but its a fact I need to accept. The problem is that it makes me problems when mocking because problematic method is having side effects when trying to find some local file which is not existent at the build machine.
It is something like this:
class BadDesignedClass {
public static final Properies = loadProperties();
private static Properties loadProperties() {
// ... loads non-existent property file and crashes...
}
}
I have problem to mock this because at the moment I mention the class inside the test class it calls real loadProperties() which is before Mockito or PowerMockito do any mocking, which results an error thrown.