use of samples.suppressmethod.SuppressMethod 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());
}
use of samples.suppressmethod.SuppressMethod in project powermock by powermock.
the class SuppressMethodTest method testSuppressMethodInParentOnly.
@Test
public void testSuppressMethodInParentOnly() throws Exception {
suppress(method(SuppressMethodParent.class, "myMethod"));
SuppressMethod tested = new SuppressMethod();
assertEquals(20, tested.myMethod());
}
use of samples.suppressmethod.SuppressMethod in project powermock by powermock.
the class SuppressMethodTest method testInvokeVoid_noParameterTypeSupplied.
@Test
public void testInvokeVoid_noParameterTypeSupplied() throws Exception {
suppress(method(SuppressMethod.class, "invokeVoid"));
SuppressMethod tested = new SuppressMethod();
// Should not cause an NPE when suppressing code.
tested.invokeVoid(null);
}
use of samples.suppressmethod.SuppressMethod in project powermock by powermock.
the class SuppressMethodTest method testGetDouble.
@Test
public void testGetDouble() throws Exception {
suppress(method(SuppressMethod.class, "getDouble"));
SuppressMethod tested = new SuppressMethod();
assertEquals("A method returning a double should return 0.0d after suppressing method code.", 0.0d, tested.getDouble(), 0);
}
use of samples.suppressmethod.SuppressMethod in project powermock by powermock.
the class SuppressMethodTest method testGetFloat.
@Test
public void testGetFloat() throws Exception {
suppress(method(SuppressMethod.class, "getFloat"));
SuppressMethod tested = new SuppressMethod();
assertEquals("A method returning a float should return 0.0f after suppressing method code.", 0.0f, tested.getFloat(), 0);
}
Aggregations