From ca394838f0fcd582f949b90a7801dc8f8e5eb396 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 23 Dec 2016 13:30:30 +0100 Subject: [PATCH] Make sinttest (Before|After)Class methods non-static --- .../smack/inttest/SmackIntegrationTestFramework.java | 8 ++++---- .../unittest/SmackIntegrationTestFrameworkUnitTest.java | 4 ++-- 2 files changed, 6 insertions(+), 6 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 00609f209..018684c32 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 @@ -327,7 +327,7 @@ public class SmackIntegrationTestFramework { Set beforeClassMethods = getAllMethods(testClass, withAnnotation(BeforeClass.class), withReturnType(Void.TYPE), withParametersCount(0), withModifier(Modifier.PUBLIC - | Modifier.STATIC)); + )); // See if there are any methods that have the @BeforeClassAnnotation but a wrong signature Set allBeforeClassMethods = getAllMethods(testClass, withAnnotation(BeforeClass.class)); @@ -340,7 +340,7 @@ public class SmackIntegrationTestFramework { Method beforeClassMethod = beforeClassMethods.iterator().next(); LOGGER.info("Executing @BeforeClass method of " + testClass); try { - beforeClassMethod.invoke(null); + beforeClassMethod.invoke(test); } catch (InvocationTargetException | IllegalAccessException e) { LOGGER.log(Level.SEVERE, "Exception executing @BeforeClass method", e); @@ -404,7 +404,7 @@ public class SmackIntegrationTestFramework { Set afterClassMethods = getAllMethods(testClass, withAnnotation(AfterClass.class), withReturnType(Void.TYPE), withParametersCount(0), withModifier(Modifier.PUBLIC - | Modifier.STATIC)); + )); // See if there are any methods that have the @AfterClassAnnotation but a wrong signature Set allAfterClassMethods = getAllMethods(testClass, withAnnotation(AfterClass.class)); @@ -417,7 +417,7 @@ public class SmackIntegrationTestFramework { Method afterClassMethod = afterClassMethods.iterator().next(); LOGGER.info("Executing @AfterClass method of " + testClass); try { - afterClassMethod.invoke(null); + afterClassMethod.invoke(test); } catch (InvocationTargetException | IllegalAccessException e) { LOGGER.log(Level.SEVERE, "Exception executing @AfterClass method", e); diff --git a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java index 3bb1c357c..b03cccf9c 100644 --- a/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java +++ b/smack-integration-test/src/test/java/org/igniterealtime/smack/inttest/unittest/SmackIntegrationTestFrameworkUnitTest.java @@ -124,12 +124,12 @@ public class SmackIntegrationTestFrameworkUnitTest { } @BeforeClass - public static void setUp() { + public void setUp() { beforeClassInvoked = true; } @AfterClass - public static void tearDown() { + public void tearDown() { afterClassInvoked = true; }