diff --git a/surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/surefire/testng/utils/MethodSelector.java b/surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/surefire/testng/utils/MethodSelector.java index 42bb4fae03..b5930ad4ef 100644 --- a/surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/surefire/testng/utils/MethodSelector.java +++ b/surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/surefire/testng/utils/MethodSelector.java @@ -61,7 +61,9 @@ private static boolean shouldRun(ITestNGMethod test) { boolean hasTestResolver = resolver != null && !resolver.isEmpty(); if (hasTestResolver) { boolean run = false; - for (Class clazz = test.getRealClass(); !run && clazz != Object.class; clazz = clazz.getSuperclass()) { + for (Class clazz = test.getRealClass(); + !run && clazz != null && clazz != Object.class; + clazz = clazz.getSuperclass()) { run = resolver.shouldRun(clazz, test.getMethodName()); } return run;