@Test public void build_LAST_PAGE() { SearchResult<EnrichmentTag> searchResult = new SearchResult<EnrichmentTag>( Lists.newArrayList(firstEnrichmentTag), null, 15, 3); Pagination pagination = new Pagination(3, 5); when(paginationTemplateFactory.createPageNumberTemplate(pagination)).thenReturn(new PageNumberTemplate(5)); when(paginationTemplateFactory.createPageSizeTemplate(pagination)).thenReturn(new PageSizeTemplate(3, 1, 99)); DumpEnrichmentTagsView view = enrichmentTagsListSuccessRepresentationBuilder .build(searchResult, pagination, uriComponentsBuilder); assertThat(view.getLinks(), contains( new Link(path + "?pageSize=3&pageNumber=5", ApiConstants.SELF), new Link(path + "?pageSize=3&pageNumber=4", ApiConstants.PREV))); assertThat(view.getItems(), contains(firstEnrichmentTagItem)); assertEquals(Integer.valueOf(5), view.getQueryTemplate().getPageNumber().getValue()); assertEquals(Integer.valueOf(3), view.getQueryTemplate().getPageSize().getValue()); assertTrue(StringUtils.contains(view.getQueryTemplate().getPageSize().getAllowedValues(), "1")); assertTrue(StringUtils.contains(view.getQueryTemplate().getPageSize().getAllowedValues(), "99")); assertNull(view.getInfo()); }
public DumpEnrichmentTagsView build(SearchResult<EnrichmentTag> searchResult, Pagination pagination, UriComponentsBuilder uriComponentsBuilder) { DumpEnrichmentTagsView dumpCourtsView = new DumpEnrichmentTagsView(); dumpCourtsView.setLinks(toLinks(pagination, uriComponentsBuilder, searchResult.isMoreRecordsExist())); dumpCourtsView.setItems(toItems(searchResult.getResultRecords())); dumpCourtsView.setQueryTemplate(toQueryTemplate(pagination)); return dumpCourtsView; }
DumpEnrichmentTagsListSuccessRepresentationBuilder { public DumpEnrichmentTagsView build(SearchResult<EnrichmentTag> searchResult, Pagination pagination, UriComponentsBuilder uriComponentsBuilder) { DumpEnrichmentTagsView dumpCourtsView = new DumpEnrichmentTagsView(); dumpCourtsView.setLinks(toLinks(pagination, uriComponentsBuilder, searchResult.isMoreRecordsExist())); dumpCourtsView.setItems(toItems(searchResult.getResultRecords())); dumpCourtsView.setQueryTemplate(toQueryTemplate(pagination)); return dumpCourtsView; } }
DumpEnrichmentTagsListSuccessRepresentationBuilder { public DumpEnrichmentTagsView build(SearchResult<EnrichmentTag> searchResult, Pagination pagination, UriComponentsBuilder uriComponentsBuilder) { DumpEnrichmentTagsView dumpCourtsView = new DumpEnrichmentTagsView(); dumpCourtsView.setLinks(toLinks(pagination, uriComponentsBuilder, searchResult.isMoreRecordsExist())); dumpCourtsView.setItems(toItems(searchResult.getResultRecords())); dumpCourtsView.setQueryTemplate(toQueryTemplate(pagination)); return dumpCourtsView; }  }
DumpEnrichmentTagsListSuccessRepresentationBuilder { public DumpEnrichmentTagsView build(SearchResult<EnrichmentTag> searchResult, Pagination pagination, UriComponentsBuilder uriComponentsBuilder) { DumpEnrichmentTagsView dumpCourtsView = new DumpEnrichmentTagsView(); dumpCourtsView.setLinks(toLinks(pagination, uriComponentsBuilder, searchResult.isMoreRecordsExist())); dumpCourtsView.setItems(toItems(searchResult.getResultRecords())); dumpCourtsView.setQueryTemplate(toQueryTemplate(pagination)); return dumpCourtsView; }  DumpEnrichmentTagsView build(SearchResult<EnrichmentTag> searchResult, Pagination pagination, UriComponentsBuilder uriComponentsBuilder); @Autowired void setDumpEnrichmentTagItemMapper(
            DumpEnrichmentTagItemMapper dumpEnrichmentTagItemMapper); @Autowired void setPaginationTemplateFactory(PaginationTemplateFactory paginationTemplateFactory); }
DumpEnrichmentTagsListSuccessRepresentationBuilder { public DumpEnrichmentTagsView build(SearchResult<EnrichmentTag> searchResult, Pagination pagination, UriComponentsBuilder uriComponentsBuilder) { DumpEnrichmentTagsView dumpCourtsView = new DumpEnrichmentTagsView(); dumpCourtsView.setLinks(toLinks(pagination, uriComponentsBuilder, searchResult.isMoreRecordsExist())); dumpCourtsView.setItems(toItems(searchResult.getResultRecords())); dumpCourtsView.setQueryTemplate(toQueryTemplate(pagination)); return dumpCourtsView; }  DumpEnrichmentTagsView build(SearchResult<EnrichmentTag> searchResult, Pagination pagination, UriComponentsBuilder uriComponentsBuilder); @Autowired void setDumpEnrichmentTagItemMapper(
            DumpEnrichmentTagItemMapper dumpEnrichmentTagItemMapper); @Autowired void setPaginationTemplateFactory(PaginationTemplateFactory paginationTemplateFactory);  }