I have a utility class with a private constructor that throws an Illegal state exception and I want to test that it does this.
I've tried a test where I implement the constructor, but since the constructor is private it can't be accessed outside of the class. So is it just pointless to test the constructor?
from the class
private UtilityClass(){
throw new IllegalStateException("Utility Class");
}
from the test class
private UtilityClass = utilityClass;
@Test(expected = IllegalStateException.class)
public void constructorTest(){
utilityClass = new UtilityClass();
}
Aucun commentaire:
Enregistrer un commentaire