use of org.powermock.reflect.exceptions.FieldNotFoundException in project powermock by powermock.
the class WhiteBoxTest method assertThatErrorMessageIsCorrectWhenNoInstanceFieldFound.
@Test
public void assertThatErrorMessageIsCorrectWhenNoInstanceFieldFound() throws Exception {
ClassWithInternalState classWithInternalState = new ClassWithInternalState();
try {
Whitebox.setInternalState(classWithInternalState, (byte) 23);
fail("Should throw a FieldNotFoundException.");
} catch (FieldNotFoundException e) {
assertEquals("No instance field assignable from \"java.lang.Byte\" could be found in the class hierarchy of " + ClassWithInternalState.class.getName() + ".", e.getMessage());
}
}
Aggregations