Search in sources :

Example 1 with SuppressField

use of samples.suppressfield.SuppressField in project powermock by powermock.

the class SuppressFieldTest method assertThatObjectIsNeverInstansiated.

@Test
public void assertThatObjectIsNeverInstansiated() throws Exception {
    suppress(field(SuppressField.class, "domainObject"));
    SuppressField suppressField = new SuppressField();
    assertNull(suppressField.getDomainObject());
}
Also used : SuppressField(samples.suppressfield.SuppressField) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with SuppressField

use of samples.suppressfield.SuppressField in project powermock by powermock.

the class SuppressFieldTest method assertThatMultipleInstanceFieldSuppressionWorks.

@Test
public void assertThatMultipleInstanceFieldSuppressionWorks() throws Exception {
    suppress(fields(SuppressField.class, "mySecondValue", "myChar"));
    SuppressField suppressField = new SuppressField();
    assertNull(suppressField.getMySecondValue());
    assertEquals(' ', suppressField.getMyChar());
    assertEquals(Boolean.TRUE, suppressField.getMyWrappedBoolean());
}
Also used : SuppressField(samples.suppressfield.SuppressField) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 3 with SuppressField

use of samples.suppressfield.SuppressField in project powermock by powermock.

the class SuppressFieldTest method assertThatSpecificInstanceFieldSuppressionWhenSpecifingClassAndFieldNameWorks.

@Test
public void assertThatSpecificInstanceFieldSuppressionWhenSpecifingClassAndFieldNameWorks() throws Exception {
    suppress(field(SuppressField.class, "mySecondValue"));
    SuppressField suppressField = new SuppressField();
    assertNull(suppressField.getMySecondValue());
}
Also used : SuppressField(samples.suppressfield.SuppressField) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 4 with SuppressField

use of samples.suppressfield.SuppressField in project powermock by powermock.

the class SuppressFieldTest method assertThatSpecificPrimitiveInstanceFieldSuppressionWorks.

@Test
public void assertThatSpecificPrimitiveInstanceFieldSuppressionWorks() throws Exception {
    suppress(field(SuppressField.class, "myChar"));
    SuppressField suppressField = new SuppressField();
    assertEquals(' ', suppressField.getMyChar());
}
Also used : SuppressField(samples.suppressfield.SuppressField) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 5 with SuppressField

use of samples.suppressfield.SuppressField in project powermock by powermock.

the class SuppressFieldTest method assertThatSpecificInstanceFieldSuppressionWorks.

@Test
public void assertThatSpecificInstanceFieldSuppressionWorks() throws Exception {
    suppress(field(SuppressField.class, "mySecondValue"));
    SuppressField suppressField = new SuppressField();
    assertNull(suppressField.getMySecondValue());
}
Also used : SuppressField(samples.suppressfield.SuppressField) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)11 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)11 SuppressField (samples.suppressfield.SuppressField)11 Ignore (org.junit.Ignore)1 SuppressConstructorHierarchy (samples.suppressconstructor.SuppressConstructorHierarchy)1 SuppressMethod (samples.suppressmethod.SuppressMethod)1