diff --git a/test-framework/arquillian/src/main/java/io/quarkus/arquillian/QuarkusJunitCallbacks.java b/test-framework/arquillian/src/main/java/io/quarkus/arquillian/QuarkusJunitCallbacks.java index e9d5ee5154241..e4f6f3c00dcc7 100644 --- a/test-framework/arquillian/src/main/java/io/quarkus/arquillian/QuarkusJunitCallbacks.java +++ b/test-framework/arquillian/src/main/java/io/quarkus/arquillian/QuarkusJunitCallbacks.java @@ -23,7 +23,9 @@ static void invokeJunitBefores(String className, Object testInstance) collectCallbacks(testInstance.getClass(), befores, (Class) testInstance.getClass() .getClassLoader().loadClass(className)); for (Method before : befores) { - before.invoke(testInstance); + if (before.canAccess(testInstance) && before.getParameters().length == 0) { + before.invoke(testInstance); + } } } } @@ -35,7 +37,9 @@ static void invokeJunitAfters(String className, Object testInstance) collectCallbacks(testInstance.getClass(), afters, (Class) testInstance.getClass() .getClassLoader().loadClass(className)); for (Method after : afters) { - after.invoke(testInstance); + if (after.canAccess(testInstance) && after.getParameters().length == 0) { + after.invoke(testInstance); + } } } }