File tree Expand file tree Collapse file tree
examples/org/hamcrest/examples
library/org/hamcrest/text
unit-test/org/hamcrest/text Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import static org .hamcrest .MatcherAssert .assertThat ;
55import static org .hamcrest .Matchers .isTwoXs ;
66import static org .hamcrest .core .IsNot .not ;
7- import static org .hamcrest .text .StringContains .stringContains ;
7+ import static org .hamcrest .text .StringContains .containsString ;
88
99/**
1010 * Demonstrates how HamCrest matchers can be used with assertThat()
@@ -17,7 +17,7 @@ public class ExampleWithAssertThat extends TestCase {
1717 public void testUsingAssertThat () {
1818 assertThat ("xx" , isTwoXs ());
1919 assertThat ("yy" , not (isTwoXs ()));
20- assertThat ("i like cheese" , stringContains ("cheese" ));
20+ assertThat ("i like cheese" , containsString ("cheese" ));
2121 }
2222
2323}
Original file line number Diff line number Diff line change 33import static org .hamcrest .MatcherAssert .assertThat ;
44import static org .hamcrest .Matchers .isTwoXs ;
55import static org .hamcrest .core .IsNot .not ;
6- import static org .hamcrest .text .StringContains .stringContains ;
6+ import static org .hamcrest .text .StringContains .containsString ;
77import org .junit .Test ;
88
99/**
@@ -18,7 +18,7 @@ public class ExampleWithAssertThat {
1818 public void usingAssertThat () {
1919 assertThat ("xx" , isTwoXs ());
2020 assertThat ("yy" , not (isTwoXs ()));
21- assertThat ("i like cheese" , stringContains ("cheese" ));
21+ assertThat ("i like cheese" , containsString ("cheese" ));
2222 }
2323
2424 /**
Original file line number Diff line number Diff line change 33import static org .hamcrest .MatcherAssert .assertThat ;
44import static org .hamcrest .Matchers .isTwoXs ;
55import static org .hamcrest .core .IsNot .not ;
6- import static org .hamcrest .text .StringContains .stringContains ;
6+ import static org .hamcrest .text .StringContains .containsString ;
77import org .testng .annotations .Test ;
88
99/**
@@ -19,7 +19,7 @@ public class ExampleWithAssertThat {
1919 public void usingAssertThat () {
2020 assertThat ("xx" , isTwoXs ());
2121 assertThat ("yy" , not (isTwoXs ()));
22- assertThat ("i like cheese" , stringContains ("cheese" ));
22+ assertThat ("i like cheese" , containsString ("cheese" ));
2323 }
2424
2525}
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ protected String relationship() {
2222 }
2323
2424 @ Factory
25- public static Matcher <String > stringContains (String substring ) {
25+ public static Matcher <String > containsString (String substring ) {
2626 return new StringContains (substring );
2727 }
2828
Original file line number Diff line number Diff line change 22 */
33package org .hamcrest .text ;
44
5- import static org .hamcrest .text .StringContains .stringContains ;
5+ import static org .hamcrest .text .StringContains .containsString ;
66import org .hamcrest .AbstractMatcherTest ;
77import org .hamcrest .Matcher ;
88
99
1010public class StringContainsTest extends AbstractMatcherTest {
1111 static final String EXCERPT = "EXCERPT" ;
1212
13- Matcher <String > stringContains = stringContains (EXCERPT );
13+ Matcher <String > stringContains = containsString (EXCERPT );
1414
1515 public void testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring () {
1616 assertTrue ("should be true if excerpt at beginning" ,
You can’t perform that action at this time.
0 commit comments