Search in sources :

Example 1 with SuppressMethodExample

use of samples.suppressmethod.SuppressMethodExample in project powermock by powermock.

the class SuppressMethodTest method suppressAllMethodsInMultipleClasses.

@Test
public void suppressAllMethodsInMultipleClasses() throws Exception {
    suppress(methodsDeclaredIn(SuppressMethod.class, SuppressMethodExample.class));
    SuppressMethod tested1 = new SuppressMethod();
    SuppressMethodExample tested2 = new SuppressMethodExample();
    // Should not cause an NPE when suppressing code.
    tested1.invokeVoid(null);
    assertNull(tested1.getObject());
    assertEquals(0, tested1.getInt());
    assertNull(tested2.getObject());
}
Also used : SuppressMethodExample(samples.suppressmethod.SuppressMethodExample) SuppressMethod(samples.suppressmethod.SuppressMethod) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 SuppressMethod (samples.suppressmethod.SuppressMethod)1 SuppressMethodExample (samples.suppressmethod.SuppressMethodExample)1