X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Frhynodge%2Ffilters%2Fwebpages%2Fsavoy%2FMovieExtractorTest.java;h=2b5988e5645843c3dc5c61cb0d7d7946b8b94872;hb=8aeef90590095a455e2323d70ba8ccae032f4276;hp=63c642a578894e71d412d7939feb7f55facbf433;hpb=c01a15c35517e70e6cc8715d3e053095b8ae1f97;p=rhynodge.git diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.java index 63c642a..2b5988e 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.java @@ -19,7 +19,7 @@ import java.util.Optional; import static java.time.LocalDateTime.of; import static java.util.Optional.empty; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.*; import static org.jsoup.Jsoup.parse; /** @@ -47,6 +47,7 @@ public class MovieExtractorTest { public void moviesAreLocated() throws IOException { assertThat(movies, containsInAnyOrder( movie("All of Us Strangers", "https://cdn.premiumkino.de/movie/2809/db0e5c3ed02ba7fe4afa3b12aabb611f.jpg", + allOf(startsWith("Sich neu verlieben, durch eine Zeitschleife"), endsWith("Quelle: disney-content.de")), performance(of(2024, 2, 9, 16, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240209/1615/HkKdhlHMvtfSMy1fqYYtYuVdgGIKtnT7i7ddY5jzRfY~"), performance(of(2024, 2, 10, 22, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240210/2215/znWqm8FQUNSbrODY_A0jw8Au2nW6uSqbFE7Co8UgQv0~"), performance(of(2024, 2, 11, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240211/2015/I642oTHBKpy7sz2RULHIQK6cykSCPi57_c0TApiKbUk~"), @@ -55,6 +56,7 @@ public class MovieExtractorTest { performance(of(2024, 2, 14, 14, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240214/1430/VZhgxh4PZutWWlLPEAe9dfOUJkB3sLnXzWoduICJYTk~") ), movie("Dune", "https://cdn.premiumkino.de/movie/3261/bcc70cb1cc4559731b6fd547d0f5cee1.jpg", + allOf(startsWith(""Dune" erzählt die packende Geschichte"), endsWith("Quelle: mediapass.warnerbros.com")), performance(of(2024, 2, 9, 19, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240209/1900/o9jDuan4yyxaW7-Jg3hCJpiAM4CLZei8J2IX-O5-hA0~"), performance(of(2024, 2, 10, 15, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240210/1530/jXbZnYD8R5djVnj3Ojjcsc9qdSJ0JBMVhn7PeP88HyY~"), performance(of(2024, 2, 11, 13, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240211/1330/aJmlM8wOaGl_jtuWDvWG9TF7RR1zRpNrSZeArCBhn90~"), @@ -62,6 +64,7 @@ public class MovieExtractorTest { performance(of(2024, 2, 13, 17, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240213/1700/QCphOtH-WrZ2tRbENwaxXPskrN2gH3I8dHR0Y5L3l0Y~") ), movie("SAVOY Sneak-Preview", "https://cdn.premiumkino.de/movie/5617/33dc4c74b4cca5cf4585b4cadfc38ec4.png", + allOf(startsWith("Wir zeigen unsere OV-Sneak freitagabends"), endsWith("Logenpreis 1,- Euro Ermäßigung. ")), performance(of(2024, 2, 9, 22, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/sneak-preview/20240209/2230/GtYBcOR_Jy7a8xDxwwPHI0wfY_v_Ep2P6rV0w4wJ7SM~"), performance(of(2024, 2, 16, 22, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/sneak-preview/20240216/2200/ZRC7iir9Hu8nIpH1PsiA_UDvckcj7yGqgMEYXHAs9Qw~") ), @@ -150,6 +153,11 @@ public class MovieExtractorTest { @SafeVarargs private Matcher movie(String name, String imageUrl, Triple... presentationTimesTypesAndLinks) { + return movie(name, imageUrl, anything(), presentationTimesTypesAndLinks); + } + + @SafeVarargs + private Matcher movie(String name, String imageUrl, Matcher descriptionMatcher, Triple... presentationTimesTypesAndLinks) { return new TypeSafeDiagnosingMatcher() { @Override protected boolean matchesSafely(Movie movie, Description mismatchDescription) { @@ -161,6 +169,10 @@ public class MovieExtractorTest { mismatchDescription.appendText("image URL is ").appendValue(movie.getImageUrl()); return false; } + if (!descriptionMatcher.matches(movie.getDescription())) { + descriptionMatcher.describeMismatch(movie.getDescription(), mismatchDescription); + return false; + } List performances = new ArrayList<>(movie.getPerformances()); if (performances.size() != presentationTimesTypesAndLinks.length) { mismatchDescription.appendText("has ").appendValue(performances.size()).appendText(" presentations"); @@ -190,6 +202,7 @@ public class MovieExtractorTest { @Override public void describeTo(Description description) { description.appendText("movie with name ").appendValue(name); + description.appendText(", description ").appendDescriptionOf(descriptionMatcher); description.appendText(" and ").appendValue(presentationTimesTypesAndLinks.length).appendText(" presentations"); } };