Search in sources :

Example 1 with EvilStaticInitializerExample

use of samples.staticinitializer.EvilStaticInitializerExample in project powermock by powermock.

the class EvilStaticInitializerExampleTest method assertNativeCodeInvocationWorks.

@Test
@SuppressStaticInitializationFor("samples.staticinitializer.EvilStaticInitializerExample")
public void assertNativeCodeInvocationWorks() {
    EvilStaticInitializerExample tested = new EvilStaticInitializerExample();
    assertThat(tested.doSomeNativeStuffUsingTheLoadedSystemLibrary(), instanceOf(String.class));
}
Also used : EvilStaticInitializerExample(samples.staticinitializer.EvilStaticInitializerExample) Test(org.junit.Test) SuppressStaticInitializationFor(org.powermock.core.classloader.annotations.SuppressStaticInitializationFor)

Aggregations

Test (org.junit.Test)1 SuppressStaticInitializationFor (org.powermock.core.classloader.annotations.SuppressStaticInitializationFor)1 EvilStaticInitializerExample (samples.staticinitializer.EvilStaticInitializerExample)1