Skip to content

Commit 5466739

Browse files
committed
tidying tests
1 parent ba93251 commit 5466739

1 file changed

Lines changed: 9 additions & 19 deletions

File tree

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

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,15 @@ protected Matcher<?> createMatcher() {
1717
return stringStartsWith;
1818
}
1919

20-
public void testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() {
21-
assertTrue("should be true if excerpt at beginning",
22-
stringStartsWith.matches(EXCERPT + "END"));
23-
assertFalse("should be false if excerpt at end",
24-
stringStartsWith.matches("START" + EXCERPT));
25-
assertFalse("should be false if excerpt in middle",
26-
stringStartsWith.matches("START" + EXCERPT + "END"));
27-
assertTrue("should be true if excerpt is at beginning and repeated",
28-
stringStartsWith.matches(EXCERPT + EXCERPT));
29-
30-
assertFalse("should be false if excerpt is not in string",
31-
stringStartsWith.matches("Something else"));
32-
assertFalse("should be false if part of excerpt is at start of string",
33-
stringStartsWith.matches(EXCERPT.substring(1)));
34-
}
35-
36-
public void testEvaluatesToTrueIfArgumentIsEqualToSubstring() {
37-
assertTrue("should be true if excerpt is entire string",
38-
stringStartsWith.matches(EXCERPT));
20+
public void testMatchesStringAtStart() {
21+
assertMatches(stringStartsWith, EXCERPT + "END");
22+
assertDoesNotMatch(stringStartsWith, "START" + EXCERPT);
23+
assertDoesNotMatch(stringStartsWith, "START" + EXCERPT + "END");
24+
assertMatches(stringStartsWith, EXCERPT);
25+
assertMatches(stringStartsWith, EXCERPT + EXCERPT);
26+
assertDoesNotMatch(stringStartsWith, "EXCER");
27+
28+
assertMismatchDescription("was \"Something else\"", stringStartsWith, "Something else");
3929
}
4030

4131
public void testHasAReadableDescription() {

0 commit comments

Comments
 (0)