Search in sources :

Example 1 with PowerMockIgnore

use of org.powermock.core.classloader.annotations.PowerMockIgnore in project powermock by powermock.

the class PowerMockIgnorePackagesExtractorImpl method addValueFromAnnotation.

private boolean addValueFromAnnotation(final AnnotatedElement element, final Set<String> ignoredPackages) {
    PowerMockIgnore annotation = element.getAnnotation(PowerMockIgnore.class);
    if (annotation != null) {
        String[] ignores = annotation.value();
        Collections.addAll(ignoredPackages, ignores);
        return annotation.globalIgnore();
    }
    return true;
}
Also used : PowerMockIgnore(org.powermock.core.classloader.annotations.PowerMockIgnore)

Example 2 with PowerMockIgnore

use of org.powermock.core.classloader.annotations.PowerMockIgnore in project powermock by powermock.

the class PowerMockIgnorePackagesExtractorImpl method getPackagesToIgnore.

@Override
public String[] getPackagesToIgnore(AnnotatedElement element) {
    PowerMockIgnore annotation = element.getAnnotation(PowerMockIgnore.class);
    boolean useGlobal = true;
    if (annotation != null) {
        useGlobal = annotation.globalIgnore();
    }
    Set<String> ignoredPackages = new HashSet<String>();
    useGlobal &= extractPackageToIgnore(element, ignoredPackages);
    final String[] packageToIgnore = ignoredPackages.toArray(new String[ignoredPackages.size()]);
    if (useGlobal) {
        return getPackageToIgnoreWithGlobal(packageToIgnore);
    } else {
        return packageToIgnore;
    }
}
Also used : PowerMockIgnore(org.powermock.core.classloader.annotations.PowerMockIgnore) HashSet(java.util.HashSet)

Aggregations

PowerMockIgnore (org.powermock.core.classloader.annotations.PowerMockIgnore)2 HashSet (java.util.HashSet)1