fest-assert-2.x
fest-assert-2.x copied to clipboard
Add StringAssert.containsSequence
In the same idea as issue 120 https://github.com/alexruiz/fest-assert-2.x/issues/120
It would nice to be able to test that different portions of a string appears in order (whatever is between them). So at each eaten verified "subsequence", the assertion will verify only to the rest of the non verified String. It could be useful to verify a portion of an XML node for example.
If I understand you correctly the assertion below would succeed ...
String book = "{ 'title':'A Game of Thrones', 'author':'George Martin'}";
assertThat(book).containsSequence("{", "title", "A Game of Thrones", "}");
... while this one would fail as "author" comes after "A Game of Thrones" :
assertThat(book).containsSequence("{", "author", "A Game of Thrones", "}");
I think this can be a nice addition to String assertions, thanks for the idea.
Precisely what I meant :)
Hackergarteny idea I think ;)