Skip to content

Commit

Permalink
Static import DEFAULT_MATCHER
Browse files Browse the repository at this point in the history
  • Loading branch information
kokosing committed Feb 1, 2019
1 parent 70800a9 commit 431e230
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -152,7 +152,7 @@ public void noMatchMeansNoCaptures()
Capture<Void> impossible = newCapture();
Pattern<Void> pattern = typeOf(Void.class).capturedAs(impossible);

Match<Void> match = DefaultMatcher.DEFAULT_MATCHER.match(pattern, 42);
Match<Void> match = DEFAULT_MATCHER.match(pattern, 42);

assertTrue(match.isEmpty());
Throwable throwable = expectThrows(NoSuchElementException.class, () -> match.capture(impossible));
Expand All @@ -165,7 +165,7 @@ public void unknownCaptureIsAnError()
Pattern<?> pattern = any();
Capture<?> unknownCapture = newCapture();

Match<?> match = DefaultMatcher.DEFAULT_MATCHER.match(pattern, 42);
Match<?> match = DEFAULT_MATCHER.match(pattern, 42);

Throwable throwable = expectThrows(NoSuchElementException.class, () -> match.capture(unknownCapture));
assertTrue(throwable.getMessage().contains("unknown Capture"));
Expand All @@ -185,14 +185,14 @@ private <T> Match<T> assertMatch(Pattern<T> pattern, T expectedMatch)

private <T, R> Match<R> assertMatch(Pattern<R> pattern, T matchedAgainst, R expectedMatch)
{
Match<R> match = DefaultMatcher.DEFAULT_MATCHER.match(pattern, matchedAgainst);
Match<R> match = DEFAULT_MATCHER.match(pattern, matchedAgainst);
assertEquals(expectedMatch, match.value());
return match;
}

private <T> void assertNoMatch(Pattern<T> pattern, Object expectedNoMatch)
{
Match<T> match = DefaultMatcher.DEFAULT_MATCHER.match(pattern, expectedNoMatch);
Match<T> match = DEFAULT_MATCHER.match(pattern, expectedNoMatch);
assertEquals(Match.empty(), match);
}
}

0 comments on commit 431e230

Please sign in to comment.