Skip to content

Commit 91df515

Browse files
committed
tidying tests
1 parent 717115e commit 91df515

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

‎hamcrest-core/src/test/java/org/hamcrest/core/StringEndsWithTest.java‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,21 @@
1010

1111
public class StringEndsWithTest extends AbstractMatcherTest {
1212
static final String EXCERPT = "EXCERPT";
13-
Matcher<String> stringEndsWith = endsWith(EXCERPT);
13+
final Matcher<String> stringEndsWith = endsWith(EXCERPT);
1414

1515
@Override
1616
protected Matcher<?> createMatcher() {
1717
return stringEndsWith;
1818
}
1919

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");
3428
}
3529

3630
public void testEvaluatesToTrueIfArgumentIsEqualToSubstring() {

0 commit comments

Comments
 (0)