|
10 | 10 |
|
11 | 11 | public class StringEndsWithTest extends AbstractMatcherTest { |
12 | 12 | static final String EXCERPT = "EXCERPT"; |
13 | | - Matcher<String> stringEndsWith = endsWith(EXCERPT); |
| 13 | + final Matcher<String> stringEndsWith = endsWith(EXCERPT); |
14 | 14 |
|
15 | 15 | @Override |
16 | 16 | protected Matcher<?> createMatcher() { |
17 | 17 | return stringEndsWith; |
18 | 18 | } |
19 | 19 |
|
20 | | - public void testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() { |
21 | | - assertFalse("should be false if excerpt at beginning", |
22 | | - stringEndsWith.matches(EXCERPT + "END")); |
23 | | - assertTrue("should be true if excerpt at end", |
24 | | - stringEndsWith.matches("START" + EXCERPT)); |
25 | | - assertFalse("should be false if excerpt in middle", |
26 | | - stringEndsWith.matches("START" + EXCERPT + "END")); |
27 | | - assertTrue("should be true if excerpt is at end and repeated", |
28 | | - stringEndsWith.matches(EXCERPT + EXCERPT)); |
29 | | - |
30 | | - assertFalse("should be false if excerpt is not in string", |
31 | | - stringEndsWith.matches("Something else")); |
32 | | - assertFalse("should be false if part of excerpt is at end of string", |
33 | | - stringEndsWith.matches(EXCERPT.substring(0, EXCERPT.length() - 2))); |
| 20 | + public void testMatchesSubstringAtEnd() { |
| 21 | + assertMatches(stringEndsWith, EXCERPT + "END"); |
| 22 | + assertMatches(stringEndsWith, "START" + EXCERPT); |
| 23 | + assertDoesNotMatch(stringEndsWith, "START" + EXCERPT + "END"); |
| 24 | + assertMatches(stringEndsWith, EXCERPT + EXCERPT); |
| 25 | + |
| 26 | + assertDoesNotMatch(stringEndsWith, "EXCER"); |
| 27 | + assertMismatchDescription("bad", stringEndsWith, "Something else"); |
34 | 28 | } |
35 | 29 |
|
36 | 30 | public void testEvaluatesToTrueIfArgumentIsEqualToSubstring() { |
|
0 commit comments