use of org.junit.platform.engine.support.descriptor.CompositeTestSource in project intellij-community by JetBrains.
the class JUnit5TestExecutionListener method getLocationHintValue.
static String getLocationHintValue(TestSource testSource, boolean isTest) {
if (testSource instanceof CompositeTestSource) {
CompositeTestSource compositeTestSource = ((CompositeTestSource) testSource);
for (TestSource sourceFromComposite : compositeTestSource.getSources()) {
String locationHintValue = getLocationHintValue(sourceFromComposite, isTest);
if (!NO_LOCATION_HINT_VALUE.equals(locationHintValue)) {
return locationHintValue;
}
}
return NO_LOCATION_HINT_VALUE;
}
if (testSource instanceof FileSource) {
FileSource fileSource = (FileSource) testSource;
File file = fileSource.getFile();
String line = fileSource.getPosition().map(position -> ":" + position.getLine()).orElse("");
return "file://" + file.getAbsolutePath() + line;
}
if (testSource instanceof MethodSource) {
MethodSource methodSource = (MethodSource) testSource;
return javaLocation(methodSource.getClassName(), methodSource.getMethodName(), isTest);
}
if (testSource instanceof ClassSource) {
String className = ((ClassSource) testSource).getClassName();
return javaLocation(className, null, isTest);
}
return NO_LOCATION_HINT_VALUE;
}
Aggregations