Skip to content

Commit

Permalink
Fixing code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
krmahadevan committed Mar 14, 2024
1 parent 73308ee commit 8c9f8ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
13 changes: 7 additions & 6 deletions testng-core/src/main/java/org/testng/TestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,10 @@ private void initMethods() {

for (ITestClass tc : m_classMap.values()) {
fixMethodsWithClass(tc.getTestMethods(), tc, testMethods);
fixMethodsWithClass(classLevelConfigs(tc, true), tc, beforeClassMethods);
fixMethodsWithClass(beforeClassConfigMethods(tc), tc, beforeClassMethods);
fixMethodsWithClass(tc.getBeforeTestMethods(), tc, null);
fixMethodsWithClass(tc.getAfterTestMethods(), tc, null);
fixMethodsWithClass(classLevelConfigs(tc, false), tc, afterClassMethods);
fixMethodsWithClass(afterClassConfigMethods(tc), tc, afterClassMethods);
fixMethodsWithClass(tc.getBeforeSuiteMethods(), tc, beforeSuiteMethods);
fixMethodsWithClass(tc.getAfterSuiteMethods(), tc, afterSuiteMethods);
fixMethodsWithClass(tc.getBeforeTestConfigurationMethods(), tc, beforeXmlTestMethods);
Expand Down Expand Up @@ -556,10 +556,11 @@ private void initMethods() {
comparator);
}

private static ITestNGMethod[] classLevelConfigs(ITestClass tc, boolean beforeConfig) {
if (beforeConfig) {
return ITestClassConfigInfo.allBeforeClassMethods(tc).toArray(ITestNGMethod[]::new);
}
private static ITestNGMethod[] beforeClassConfigMethods(ITestClass tc) {
return ITestClassConfigInfo.allBeforeClassMethods(tc).toArray(ITestNGMethod[]::new);
}

private static ITestNGMethod[] afterClassConfigMethods(ITestClass tc) {
return ITestClassConfigInfo.allAfterClassMethods(tc).toArray(ITestNGMethod[]::new);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ public interface ITestClassConfigInfo {
*
* @return all before class config methods
*/
default List<ITestNGMethod> getAllBeforeClassMethods() {
return Lists.newArrayList();
}
List<ITestNGMethod> getAllBeforeClassMethods();

default List<ITestNGMethod> getAllAfterClassMethods() {
return Lists.newArrayList();
}
List<ITestNGMethod> getAllAfterClassMethods();

/**
* Query the instance before class methods from config methods map.
Expand Down

0 comments on commit 8c9f8ac

Please sign in to comment.