@Test public void shouldReturnEmptyListIfRequestedStartPositionIsBeyondTheSizeOfTheList() { CoordinatorService service = new CoordinatorService(); List<DNCWorkCoordinate> coordinateList = new ArrayList<>(); DNCWorkCoordinate coordinate1 = new DNCWorkCoordinate(); coordinate1.setPatientId(1); DNCWorkCoordinate coordinate2 = new DNCWorkCoordinate(); coordinate2.setPatientId(12); DNCWorkCoordinate coordinate3 = new DNCWorkCoordinate(); coordinate3.setPatientId(13); DNCWorkCoordinate coordinate4 = new DNCWorkCoordinate(); coordinate4.setPatientId(14); DNCWorkCoordinate coordinate5 = new DNCWorkCoordinate(); coordinate5.setPatientId(15); DNCWorkCoordinate coordinate6 = new DNCWorkCoordinate(); coordinate6.setPatientId(16); coordinateList.add(coordinate1); coordinateList.add(coordinate2); coordinateList.add(coordinate3); coordinateList.add(coordinate4); coordinateList.add(coordinate5); coordinateList.add(coordinate6); List<DNCWorkCoordinate> list = service.getChunkOfList(coordinateList, 7, 4); assertThat(CollectionUtils.isEmpty(list), equalTo(true)); }
public List<DNCWorkCoordinate> getChunkOfList(List<DNCWorkCoordinate> coordinateList, long start, int size) { return coordinateList.stream().skip(start).limit(size).collect(Collectors.toList()); }
CoordinatorService { public List<DNCWorkCoordinate> getChunkOfList(List<DNCWorkCoordinate> coordinateList, long start, int size) { return coordinateList.stream().skip(start).limit(size).collect(Collectors.toList()); } }
CoordinatorService { public List<DNCWorkCoordinate> getChunkOfList(List<DNCWorkCoordinate> coordinateList, long start, int size) { return coordinateList.stream().skip(start).limit(size).collect(Collectors.toList()); }  }
CoordinatorService { public List<DNCWorkCoordinate> getChunkOfList(List<DNCWorkCoordinate> coordinateList, long start, int size) { return coordinateList.stream().skip(start).limit(size).collect(Collectors.toList()); }  void startServer(); List<DNCWorkCoordinate> getChunkOfList(List<DNCWorkCoordinate> coordinateList, long start, int size); }
CoordinatorService { public List<DNCWorkCoordinate> getChunkOfList(List<DNCWorkCoordinate> coordinateList, long start, int size) { return coordinateList.stream().skip(start).limit(size).collect(Collectors.toList()); }  void startServer(); List<DNCWorkCoordinate> getChunkOfList(List<DNCWorkCoordinate> coordinateList, long start, int size); static String NO_COORDINATE_LEFT; }