Experiment with unifying Artwork interface for all databases

This commit is contained in:
Reinhard Pointner 2016-04-19 07:09:11 +00:00
parent e986103a1c
commit d616f5ab3f
2 changed files with 4 additions and 2 deletions

View File

@ -53,8 +53,8 @@ public class Artwork implements Serializable {
return rating;
}
public boolean matches(String tag) {
return stream(category).anyMatch(tag::equals);
public boolean matches(String... tags) {
return stream(tags).filter(Objects::nonNull).allMatch(tag -> stream(category).anyMatch(tag::equals));
}
@Override

View File

@ -138,6 +138,8 @@ public class TheTVDBClient2Test {
assertEquals("[fanart, 1280x720]", i.getCategory().toString());
assertEquals("http://thetvdb.com/banners/fanart/original/70327-1.jpg", i.getUrl().toString());
assertTrue(i.matches("fanart", "1280x720"));
assertFalse(i.matches("fanart", "1280x720", "1"));
}
}