Custom list matching with custom matcher.
exactly(1, result.getContents) should (
have(
'user("H4mm3R"),
'url("http://a4-klub.pl/index.php?/topic/225383-galeria-b7-zdjecia-i-filmy/page-2#entry3823739"),
'id(Content.Id.newBuilder()
.addContainer(Crawler.encodeAsciiString("225383"))
.addText(Crawler.encodeAsciiString("3823739")).build())
)
and valueContains("go na forum i jeszcze zwykłe lampy ")
and not(valueContains("aa, bo ja mam zwykłe lampy i mi się ta"))
)
def valueContains(expected: String) =
Matcher { (left: Content) =>
MatchResult(
left.getValue.contains(expected),
s"Content with id $left.getId doesn't contain $expected",
s"Content with id $left.getId contains $expected"
)
}