Skip to content

Commit

Permalink
Merge pull request #112 from jenkinsci/dependabot/maven/edu.hm.hafner…
Browse files Browse the repository at this point in the history
…-codingstyle-pom-4.12.0

Bump edu.hm.hafner:codingstyle-pom from 4.11.0 to 4.12.0
  • Loading branch information
uhafner authored Jun 7, 2024
2 parents ca0d85f + 7d4ca4b commit 53d4e60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>edu.hm.hafner</groupId>
<artifactId>codingstyle-pom</artifactId>
<version>4.11.0</version>
<version>4.12.0</version>
<relativePath />
</parent>

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/edu/hm/hafner/coverage/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -694,26 +694,25 @@ private String createTargetClassName(final ClassNode testClassNode) {
*
* @return a new tree with the merged {@link Node nodes}
*/
public static Node merge(final List<? extends Node> nodes) {
public static Node merge(final List<Node> nodes) {
if (nodes.isEmpty()) {
throw new IllegalArgumentException("Cannot merge an empty list of nodes");
}
if (nodes.size() == 1) {
return nodes.get(0); // No merge required
}

Map<ImmutablePair<String, Metric>, ? extends List<? extends Node>> grouped = nodes.stream()
Map<ImmutablePair<String, Metric>, ? extends List<Node>> grouped = nodes.stream()
.collect(Collectors.groupingBy(n -> new ImmutablePair<>(n.getName(), n.getMetric())));

if (grouped.size() == 1) {
return nodes.stream()
.map(t -> (Node) t)
.reduce(Node::merge)
.orElseThrow(() -> new NoSuchElementException("No node found"));

Check warning on line 711 in src/main/java/edu/hm/hafner/coverage/Node.java

View workflow job for this annotation

GitHub Actions / Quality Monitor

Not covered line

Line 711 is not covered by tests
}

var container = new ContainerNode("Container"); // non-compatible nodes will be added to a new container node
for (List<? extends Node> matching : grouped.values()) {
for (List<Node> matching : grouped.values()) {
container.addChild(merge(matching));
}
return container;
Expand Down

0 comments on commit 53d4e60

Please sign in to comment.