Skip to content
Permalink
Browse files

Step 7: Filtering by Issue Type

  • Loading branch information...
tlinkowski committed Jan 31, 2019
1 parent d7572ba commit 31e9139a1f29df0c2a51328aa05a62046d36fbf0
Showing with 13 additions and 0 deletions.
  1. +3 −0 IssueWiseText.java
  2. +4 −0 ProbabilisticIssueWiseText.java
  3. +6 −0 Usage.java
@@ -1,7 +1,10 @@
import java.util.List;
import java.util.function.Predicate;

interface IssueWiseText {
String text(); // e.g. "You migth know it."

List<? extends Issue> issues(); // e.g. ["migth"]

IssueWiseText filtered(Predicate<? super Issue> issueFilter);
}
@@ -1,6 +1,10 @@
import java.util.List;
import java.util.function.Predicate;

interface ProbabilisticIssueWiseText extends IssueWiseText {
@Override
List<? extends ProbableIssue> issues();

@Override
ProbabilisticIssueWiseText filtered(Predicate<? super Issue> issueFilter);
}
@@ -5,6 +5,12 @@ static double issueCoverage(Stream<? extends IssueWiseText> textStream) {
return textStream.collect(IssueCoverage.collector());
}

static double issueCoverage(Stream<? extends IssueWiseText> textStream, IssueType issueType) {
return textStream
.map(text -> text.filtered(issue -> issue.type() == issueType))
.collect(IssueCoverage.collector());
}

static Stream<IssueWiseText> testCaseStream() {
return Stream.of();
}

0 comments on commit 31e9139

Please sign in to comment.
You can’t perform that action at this time.