Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add StringAssert.containsSequence #147

Open
bric3 opened this issue Feb 19, 2013 · 3 comments
Open

Add StringAssert.containsSequence #147

bric3 opened this issue Feb 19, 2013 · 3 comments

Comments

@bric3
Copy link

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
Copy link
Contributor

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
Copy link
Author

bric3 commented Feb 19, 2013

Precisely what I meant :)

Hackergarteny idea I think ;)

@joel-costigliola
Copy link
Contributor

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants