use of samples.suppressconstructor.SuppressConstructorHierarchy in project powermock by powermock.
the class SuppressConstructorHierarchyDemoTest method testGetNumber.
/**
* This simple test demonstrate that it's possible to continue execution
* with the default {@code PrepareForTest} settings (i.e. using a
* byte-code manipulated version of the SuppressConstructorHierarchyDemo
* class).
*/
public void testGetNumber() throws Exception {
suppress(constructor(SuppressConstructorHierarchy.class));
SuppressConstructorHierarchy tested = new SuppressConstructorHierarchy("message");
assertEquals(42, tested.getNumber());
}
use of samples.suppressconstructor.SuppressConstructorHierarchy in project powermock by powermock.
the class SuppressConstructorHierarchyDemoTest method testSuppressConstructor.
public void testSuppressConstructor() throws Exception {
suppress(constructor(SuppressConstructorHierarchy.class));
SuppressConstructorHierarchy tested = new SuppressConstructorHierarchy("message");
final String message = tested.getMessage();
assertNull("Message should have been null since we're skipping the execution of the constructor code. Message was \"" + message + "\".", message);
}
use of samples.suppressconstructor.SuppressConstructorHierarchy in project powermock by powermock.
the class SuppressConstructorHierarchyDemoTest method testSuppressConstructorHierarchyAgain.
/**
* This simple test demonstrate that it's possible to continue execution
* with the default {@code PrepareForTest} settings (i.e. using a
* byte-code manipulated version of the SuppressConstructorHierarchyDemo
* class).
*/
@Test
public void testSuppressConstructorHierarchyAgain() throws Exception {
suppress(constructor(SuppressConstructorHierarchy.class));
SuppressConstructorHierarchy tested = new SuppressConstructorHierarchy("message");
assertEquals(42, tested.getNumber());
}
use of samples.suppressconstructor.SuppressConstructorHierarchy in project powermock by powermock.
the class MemberModificationExampleTest method suppressConstructorExample.
@Test
public void suppressConstructorExample() throws Exception {
suppress(constructor(SuppressConstructorHierarchy.class));
SuppressConstructorHierarchy tested = new SuppressConstructorHierarchy("message");
assertEquals(42, tested.getNumber());
assertNull(tested.getMessage());
}
use of samples.suppressconstructor.SuppressConstructorHierarchy in project powermock by powermock.
the class MemberModificationExampleTest method suppressConstructorExample.
@Test
public void suppressConstructorExample() throws Exception {
suppress(constructor(SuppressConstructorHierarchy.class));
SuppressConstructorHierarchy tested = new SuppressConstructorHierarchy("message");
assertEquals(42, tested.getNumber());
assertNull(tested.getMessage());
}
Aggregations