Add StringAssert.containsSequence #147

bric3 opened this Issue Feb 19, 2013 · 3 comments


None yet
2 participants

bric3 commented Feb 19, 2013

In the same idea as issue 120 #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.


joel-costigliola commented Feb 19, 2013

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.

bric3 commented Feb 19, 2013

Precisely what I meant :)

Hackergarteny idea I think ;)


joel-costigliola commented Apr 15, 2013

For your information, this issue has been fixed in AssertJ a fork of Fest Assert 2.0M10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment