forked from TNG/JGiven
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
jgiven-core/src/main/java/com/tngtech/jgiven/report/asciidoc/HierarchyCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.tngtech.jgiven.report.asciidoc; | ||
|
||
import com.tngtech.jgiven.report.model.Tag; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
public class HierarchyCalculator { | ||
private final Map<String, List<String>> taggedScenarioFiles; | ||
private final Map<String, Tag> allTags; | ||
|
||
public HierarchyCalculator(final Map<String, Tag> allTags, final Map<String, List<String>> taggedScenarioFiles) { | ||
this.taggedScenarioFiles = taggedScenarioFiles; | ||
this.allTags = allTags; | ||
} | ||
|
||
Map<String, Map<String, List<String>>> computeGroupedTag() { | ||
return taggedScenarioFiles.entrySet().stream() | ||
.filter(entry -> allTags.get(entry.getKey()).getShownInNavigation()) | ||
.collect(Collectors.groupingBy(this::fullType, Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); | ||
} | ||
|
||
private String fullType(final Map.Entry<String, List<String>> entry) { | ||
final Tag tag = allTags.get(entry.getKey()); | ||
|
||
return tag.getFullType(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters