Hi there,
While writing the unit test cases for api/commands there is a call to a static method of class UserContext (UserContext.current().setEventDetails("Vm Id: " +getVirtualMachineId()+ " ISO Id: "+getId());). I’m unable to mock this static class. I’m using Mockito 1.9.5 for unit testing , I also tried PowerMock 1.4.12 for the static class mocking but it fails with the following error : Caused by: *java.lang.ClassNotFoundException*: com.cloud.configuration.DefaultInterceptorLibrary at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(*Native Method*) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(* MockClassLoader.java:143*) Can anyone help me to know how I can mock this static class ? - Meghna.