mismatchDescription.appendText("movie is named ").appendValue(movie.getName());
return false;
}
- List<TicketLink> ticketLinks = new ArrayList<>(movie.getTicketLinks());
- if (ticketLinks.size() != presentationTimesAndLinks.length) {
- mismatchDescription.appendText("has ").appendValue(ticketLinks.size()).appendText(" presentations");
+ List<Performance> performances = new ArrayList<>(movie.getPerformances());
+ if (performances.size() != presentationTimesAndLinks.length) {
+ mismatchDescription.appendText("has ").appendValue(performances.size()).appendText(" presentations");
return false;
}
for (Pair<LocalDateTime, String> presentationTimeAndLink : presentationTimesAndLinks) {
- Optional<TicketLink> foundTicketLink = empty();
- for (TicketLink ticketLink : ticketLinks) {
- if (ticketLink.getPresentationTime().equals(presentationTimeAndLink.getFirst()) && ticketLink.getLink().equals(presentationTimeAndLink.getSecond())) {
- foundTicketLink = Optional.of(ticketLink);
+ Optional<Performance> foundLink = empty();
+ for (Performance performance : performances) {
+ if (performance.getTime().equals(presentationTimeAndLink.getFirst()) && performance.getLink().equals(presentationTimeAndLink.getSecond())) {
+ foundLink = Optional.of(performance);
break;
}
}
- if (!foundTicketLink.isPresent()) {
+ if (!foundLink.isPresent()) {
mismatchDescription.appendValue("has no presentation at ").appendValue(presentationTimeAndLink.getFirst());
return false;
}
- ticketLinks.remove(foundTicketLink.get());
+ performances.remove(foundLink.get());
}
- if (!ticketLinks.isEmpty()) {
- mismatchDescription.appendText("has no presentations at ").appendValueList("", ", ", "", ticketLinks);
+ if (!performances.isEmpty()) {
+ mismatchDescription.appendText("has no presentations at ").appendValueList("", ", ", "", performances);
return false;
}
return true;