I am trying to unit test a code that deals with Message Logging which brings in a lot of environmental dependency. This Message Logger is a framework used by all developers across teams. I have used PowerMock for the same since the Logging class is a static class.
Though the Junit Unit test runs Green after using Power Mock, it is still attempting to load the server.xml file.
The Class calls are as follows
Unit Test Class calls -> Static Logger Class calls-> Static Environment Class.
This Static Environment Class deals with loading and parsing the server.xml file.
I have tried the following as well but even then its tring to load the xml file:
@RunWith(PowerMockRunner.class)
@PrepareForTest({Logger.class,EnvFunctions.class})
PowerMockito.mockStatic(Logger.class);
PowerMockito.mockStatic(EnvFunctions.class);
Do i need to do some extra work for it to no longer attempt to load that file?
I am tyring to mock a static void class and have tried to use doNothing and supress as well. but its not working out
doNothing.when(Logger.class);
suppress(everythingDeclaredIn(Logger.class));