Skip to content

Refactor: something is wrong with the following condition #137

@danglotb

Description

@danglotb

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);
}
}
);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions