I am new to JUnit testing. I want to mock a singleton class. The class looks like this.
public enum MockClass{
INSTANCE;
private MockClass(){
//private constructor
}
public void convertToString(int a){
return SomeClass.setString(a.toString());
}
}
I want to mock this class such that whenever there is a call to MockClass.INSTANCE.convertToString(a), nothing should be executed. There is a function in PowerMockito called doNothing(). But what do I do for Singleton classes as shown above? In this case PowerMockito doesn't help.
Aucun commentaire:
Enregistrer un commentaire