Skip to content

Commit 7ebb8d7

Browse files
committed
add pickle uri fallback for classname
1 parent dfaec0e commit 7ebb8d7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

java/src/main/java/io/cucumber/junitxmlformatter/XmlReportData.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,19 @@ int getTestCaseCount() {
6060
return query.findAllTestCaseStarted().size();
6161
}
6262

63-
String getPickleName(TestCaseStarted testCaseStarted) {
64-
Pickle pickle = query.findPickleBy(testCaseStarted)
63+
private Pickle getPickle(TestCaseStarted testCaseStarted) {
64+
return query.findPickleBy(testCaseStarted)
6565
.orElseThrow(() -> new IllegalStateException("No pickle for " + testCaseStarted.getId()));
66+
}
6667

67-
return query.findNameOf(pickle, namingStrategy);
68+
String getPickleName(TestCaseStarted testCaseStarted) {
69+
return query.findNameOf(getPickle(testCaseStarted), namingStrategy);
6870
}
6971

7072
String getFeatureName(TestCaseStarted testCaseStarted) {
7173
return query.findFeatureBy(testCaseStarted)
7274
.map(Feature::getName)
73-
.orElseThrow(() -> new IllegalStateException("No feature for " + testCaseStarted));
75+
.orElseGet(() -> this.getPickle(testCaseStarted).getUri());
7476
}
7577

7678
List<Entry<String, String>> getStepsAndResult(TestCaseStarted testCaseStarted) {

0 commit comments

Comments
 (0)