1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 00:02:06 +01:00

Make sinttest (Before|After)Class methods non-static

This commit is contained in:
Florian Schmaus 2016-12-23 13:30:30 +01:00
parent 01169a956c
commit ca394838f0
2 changed files with 6 additions and 6 deletions

View file

@ -327,7 +327,7 @@ public class SmackIntegrationTestFramework {
Set<Method> beforeClassMethods = getAllMethods(testClass, Set<Method> beforeClassMethods = getAllMethods(testClass,
withAnnotation(BeforeClass.class), withReturnType(Void.TYPE), withAnnotation(BeforeClass.class), withReturnType(Void.TYPE),
withParametersCount(0), withModifier(Modifier.PUBLIC withParametersCount(0), withModifier(Modifier.PUBLIC
| Modifier.STATIC)); ));
// See if there are any methods that have the @BeforeClassAnnotation but a wrong signature // See if there are any methods that have the @BeforeClassAnnotation but a wrong signature
Set<Method> allBeforeClassMethods = getAllMethods(testClass, withAnnotation(BeforeClass.class)); Set<Method> allBeforeClassMethods = getAllMethods(testClass, withAnnotation(BeforeClass.class));
@ -340,7 +340,7 @@ public class SmackIntegrationTestFramework {
Method beforeClassMethod = beforeClassMethods.iterator().next(); Method beforeClassMethod = beforeClassMethods.iterator().next();
LOGGER.info("Executing @BeforeClass method of " + testClass); LOGGER.info("Executing @BeforeClass method of " + testClass);
try { try {
beforeClassMethod.invoke(null); beforeClassMethod.invoke(test);
} }
catch (InvocationTargetException | IllegalAccessException e) { catch (InvocationTargetException | IllegalAccessException e) {
LOGGER.log(Level.SEVERE, "Exception executing @BeforeClass method", e); LOGGER.log(Level.SEVERE, "Exception executing @BeforeClass method", e);
@ -404,7 +404,7 @@ public class SmackIntegrationTestFramework {
Set<Method> afterClassMethods = getAllMethods(testClass, Set<Method> afterClassMethods = getAllMethods(testClass,
withAnnotation(AfterClass.class), withReturnType(Void.TYPE), withAnnotation(AfterClass.class), withReturnType(Void.TYPE),
withParametersCount(0), withModifier(Modifier.PUBLIC withParametersCount(0), withModifier(Modifier.PUBLIC
| Modifier.STATIC)); ));
// See if there are any methods that have the @AfterClassAnnotation but a wrong signature // See if there are any methods that have the @AfterClassAnnotation but a wrong signature
Set<Method> allAfterClassMethods = getAllMethods(testClass, withAnnotation(AfterClass.class)); Set<Method> allAfterClassMethods = getAllMethods(testClass, withAnnotation(AfterClass.class));
@ -417,7 +417,7 @@ public class SmackIntegrationTestFramework {
Method afterClassMethod = afterClassMethods.iterator().next(); Method afterClassMethod = afterClassMethods.iterator().next();
LOGGER.info("Executing @AfterClass method of " + testClass); LOGGER.info("Executing @AfterClass method of " + testClass);
try { try {
afterClassMethod.invoke(null); afterClassMethod.invoke(test);
} }
catch (InvocationTargetException | IllegalAccessException e) { catch (InvocationTargetException | IllegalAccessException e) {
LOGGER.log(Level.SEVERE, "Exception executing @AfterClass method", e); LOGGER.log(Level.SEVERE, "Exception executing @AfterClass method", e);

View file

@ -124,12 +124,12 @@ public class SmackIntegrationTestFrameworkUnitTest {
} }
@BeforeClass @BeforeClass
public static void setUp() { public void setUp() {
beforeClassInvoked = true; beforeClassInvoked = true;
} }
@AfterClass @AfterClass
public static void tearDown() { public void tearDown() {
afterClassInvoked = true; afterClassInvoked = true;
} }