diff --git a/src/main/java/com/microfocus/application/automation/tools/octane/tests/junit/JUnitExtension.java b/src/main/java/com/microfocus/application/automation/tools/octane/tests/junit/JUnitExtension.java index 2883b4396..e29f7219a 100644 --- a/src/main/java/com/microfocus/application/automation/tools/octane/tests/junit/JUnitExtension.java +++ b/src/main/java/com/microfocus/application/automation/tools/octane/tests/junit/JUnitExtension.java @@ -71,6 +71,7 @@ import java.nio.file.Paths; import java.util.*; import java.util.regex.Pattern; +import java.util.stream.Collectors; import static com.hp.octane.integrations.utils.SdkConstants.JobParameters.OCTANE_CONFIG_ID_PARAMETER_NAME; @@ -232,9 +233,10 @@ public GetJUnitTestResults(Run build, HPRunnerType hpRunnerType, List nodes = new ArrayList<>(); - allWorkspaces.forEach(workspace-> nodes.add(JenkinsUtils.getCurrentNode(workspace))); + List nodes = allWorkspaces.stream() + .map(JenkinsUtils::getCurrentNode) + .collect(Collectors.toList()); nodes.forEach(node -> this.nodeNames.add(node != null && !node.getNodeName().isEmpty() ? node.getNodeName() : "")); //extract folder names for created tests diff --git a/src/main/java/com/microfocus/application/automation/tools/octane/tests/junit/JUnitXmlIterator.java b/src/main/java/com/microfocus/application/automation/tools/octane/tests/junit/JUnitXmlIterator.java index 0983fda22..723b77aa9 100644 --- a/src/main/java/com/microfocus/application/automation/tools/octane/tests/junit/JUnitXmlIterator.java +++ b/src/main/java/com/microfocus/application/automation/tools/octane/tests/junit/JUnitXmlIterator.java @@ -275,13 +275,16 @@ private void handleJUnitTest(XMLEvent event) throws XMLStreamException, IOExcept Optional optional = createdTests.stream().filter(str -> str.contains(searchFor)).findFirst(); if (optional.isPresent()) { String nodeTestString = optional.get(); - String node = nodeTestString.split("/")[0]; - if (nodeNames.contains(node)) { - nodeName = node; + if(nodeTestString.contains("/")){ + String node = nodeTestString.split("/")[0]; + if (nodeNames.contains(node)) { + nodeName = node; + } + + cleanedTestName = nodeTestString.split("/")[1]; + createdTests.remove(nodeTestString); } - cleanedTestName = nodeTestString.split("/")[1]; - createdTests.remove(nodeTestString); } testReportCreated = optional.isPresent(); }