From 328da5a7e208678bc8018385dfe698f40a90f3dd Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 4 Apr 2015 17:38:00 +0200 Subject: [PATCH] Throw IAE on wrong signature (after|before)Class methods as otherwhise the reflective invokation will eventually throw an Exception like Exception in thread "main" java.lang.NullPointerException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.runTests(SmackIntegrationTestFramework.java:412) at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.run(SmackIntegrationTestFramework.java:163) at org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.main(SmackIntegrationTestFramework.java:89) :smack-integration-test:run FAILED --- .../smack/inttest/SmackIntegrationTestFramework.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java index 351832fba..18a609720 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java @@ -334,7 +334,7 @@ public class SmackIntegrationTestFramework { Set allBeforeClassMethods = getAllMethods(testClass, withAnnotation(BeforeClass.class)); allBeforeClassMethods.removeAll(beforeClassMethods); if (!allBeforeClassMethods.isEmpty()) { - LOGGER.warning("@BeforeClass methods with wrong signature found"); + throw new IllegalArgumentException("@BeforeClass methods with wrong signature found"); } if (beforeClassMethods.size() == 1) { @@ -403,7 +403,7 @@ public class SmackIntegrationTestFramework { Set allAfterClassMethods = getAllMethods(testClass, withAnnotation(AfterClass.class)); allAfterClassMethods.removeAll(afterClassMethods); if (!allAfterClassMethods.isEmpty()) { - LOGGER.warning("@AfterClass methods with wrong signature found"); + throw new IllegalArgumentException("@AfterClass methods with wrong signature found"); } if (afterClassMethods.size() == 1) {