Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: something is wrong with the following condition #137

Open
danglotb opened this issue Mar 9, 2022 · 0 comments
Open

Refactor: something is wrong with the following condition #137

danglotb opened this issue Mar 9, 2022 · 0 comments

Comments

@danglotb
Copy link
Member

danglotb commented Mar 9, 2022

if (testMethodNames.length == 0) {
if (testClassNames.length > 0) {
Arrays.asList(testClassNames).forEach(testClassName -> {
try {
final Class<?> clazz = customClassLoader.loadClass(testClassName);
requestBuilder.selectors(selectClass(clazz));
} catch (ClassNotFoundException e) {
if (numberOfFailedLoadClass.incrementAndGet() > nbFailingLoadClass) {
throw new RuntimeException(e);
}
e.printStackTrace();
}
}
);
} else {
try {
requestBuilder.selectors(selectClass(customClassLoader.loadClass(testClassNames[0])));
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
} else {
Arrays.asList(testMethodNames).forEach(testMethodName -> {
try {
// If there is no class name in the method name, we try the first class
if (!testMethodName.contains("#")) {
requestBuilder.selectors(selectMethod(customClassLoader.loadClass(testClassNames[0]), testMethodName));
} else {
// Else we load the fully qualified method name
String className = testMethodName.split("#")[0];
String methodName = testMethodName.split("#")[1];
requestBuilder.selectors(selectMethod(customClassLoader.loadClass(className), methodName));
}
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant