QuerySet implements MessagePageRequest { public boolean lastPage() { return max != null && after == null && ofNullable(before).filter(StringUtils::isBlank).isPresent(); } QuerySet(Set set); static QuerySet empty(); @Override Optional<Long> pageSize(); @Override Optional<String> firstMessageId(); @Override Optional<String> lastMessageId(); boolean lastPage();  }
@Test public void maxAndFirstMessageIdBlankIsALastPageQuery() throws XMLSemanticError { Set set = Set.builder().max(10L).before("").build(); QuerySet tested = new QuerySet(set); assertTrue(tested.lastPage()); }
@Test public void maxAndFirstMessageIdBlankAndLastMessageIdNotBlankIsNotALastPageQuery() throws XMLSemanticError { Set set = Set.builder().max(10L).after("first").before("").build(); QuerySet tested = new QuerySet(set); assertFalse(tested.lastPage()); }