@Test public void executeWithWith() throws XMLSemanticError { when(x.getWith()).thenReturn(Optional.of(JULIET)); ArchivedMessages archivedMessages = mock(ArchivedMessages.class); when(archive.fetchSortedByOldestFirst(any(), any())).thenReturn(archivedMessages); assertEquals(archivedMessages, tested.execute()); }
public ArchivedMessages execute() throws XMLSemanticError { ArchiveFilter archiveFilter = new ArchiveFilter(archiveId, query.getX()); QuerySet querySet = query.getSet(); if (querySet.lastPage()) { long pageSize = querySet.pageSize().orElseThrow( () -> new IllegalArgumentException("Page size must be defined when requesting last page")); return archive.fetchLastPageSortedByOldestFirst(archiveFilter, pageSize); } else { return archive.fetchSortedByOldestFirst(archiveFilter, querySet); } }
ArchiveQuery { public ArchivedMessages execute() throws XMLSemanticError { ArchiveFilter archiveFilter = new ArchiveFilter(archiveId, query.getX()); QuerySet querySet = query.getSet(); if (querySet.lastPage()) { long pageSize = querySet.pageSize().orElseThrow( () -> new IllegalArgumentException("Page size must be defined when requesting last page")); return archive.fetchLastPageSortedByOldestFirst(archiveFilter, pageSize); } else { return archive.fetchSortedByOldestFirst(archiveFilter, querySet); } } }
ArchiveQuery { public ArchivedMessages execute() throws XMLSemanticError { ArchiveFilter archiveFilter = new ArchiveFilter(archiveId, query.getX()); QuerySet querySet = query.getSet(); if (querySet.lastPage()) { long pageSize = querySet.pageSize().orElseThrow( () -> new IllegalArgumentException("Page size must be defined when requesting last page")); return archive.fetchLastPageSortedByOldestFirst(archiveFilter, pageSize); } else { return archive.fetchSortedByOldestFirst(archiveFilter, querySet); } } ArchiveQuery(MessageArchive archive, Entity archiveId, Query query); }
ArchiveQuery { public ArchivedMessages execute() throws XMLSemanticError { ArchiveFilter archiveFilter = new ArchiveFilter(archiveId, query.getX()); QuerySet querySet = query.getSet(); if (querySet.lastPage()) { long pageSize = querySet.pageSize().orElseThrow( () -> new IllegalArgumentException("Page size must be defined when requesting last page")); return archive.fetchLastPageSortedByOldestFirst(archiveFilter, pageSize); } else { return archive.fetchSortedByOldestFirst(archiveFilter, querySet); } } ArchiveQuery(MessageArchive archive, Entity archiveId, Query query); ArchivedMessages execute(); }
ArchiveQuery { public ArchivedMessages execute() throws XMLSemanticError { ArchiveFilter archiveFilter = new ArchiveFilter(archiveId, query.getX()); QuerySet querySet = query.getSet(); if (querySet.lastPage()) { long pageSize = querySet.pageSize().orElseThrow( () -> new IllegalArgumentException("Page size must be defined when requesting last page")); return archive.fetchLastPageSortedByOldestFirst(archiveFilter, pageSize); } else { return archive.fetchSortedByOldestFirst(archiveFilter, querySet); } } ArchiveQuery(MessageArchive archive, Entity archiveId, Query query); ArchivedMessages execute();  }