use of org.powermock.core.classloader.annotations.SuppressStaticInitializationFor in project powermock by powermock.
the class StaticConstructorSuppressExtractorImpl method getClassesToModify.
@Override
public String[] getClassesToModify(AnnotatedElement element) {
List<String> all = new LinkedList<String>();
final SuppressStaticInitializationFor suppressAnnotation = element.getAnnotation(SuppressStaticInitializationFor.class);
if (suppressAnnotation == null) {
return null;
} else {
final String[] value = suppressAnnotation.value();
for (String classToSuppress : value) {
if (!"".equals(classToSuppress)) {
all.add(classToSuppress);
MockRepository.addSuppressStaticInitializer(classToSuppress);
}
}
}
return all.toArray(new String[all.size()]);
}
use of org.powermock.core.classloader.annotations.SuppressStaticInitializationFor 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));
}
Aggregations