@Test public void shouldReturnEmptyCollectionForZeroLimit() throws Exception { InternalCriteria userCriteria = new InternalCriteria.Builder().limit(0).offset(5).create(); RepositorySearchTask strategy = new RepositorySearchTaskV5_5(userCriteria, mSearchUseCase); List<Resource> result = strategy.nextLookup(); assertThat(result, is(empty())); verifyZeroInteractions(mSearchUseCase); }
@NotNull @Override public List<Resource> nextLookup() throws ServiceException { int limit = mInitialCriteria.getLimit(); int offset = mInitialCriteria.getOffset(); if (mEndReached || limit == 0) { return EMPTY_RESPONSE; } calculateDisposition(offset); return Collections.unmodifiableList(internalSearch(limit)); }
RepositorySearchTaskV5_5 extends RepositorySearchTask { @NotNull @Override public List<Resource> nextLookup() throws ServiceException { int limit = mInitialCriteria.getLimit(); int offset = mInitialCriteria.getOffset(); if (mEndReached || limit == 0) { return EMPTY_RESPONSE; } calculateDisposition(offset); return Collections.unmodifiableList(internalSearch(limit)); } }
RepositorySearchTaskV5_5 extends RepositorySearchTask { @NotNull @Override public List<Resource> nextLookup() throws ServiceException { int limit = mInitialCriteria.getLimit(); int offset = mInitialCriteria.getOffset(); if (mEndReached || limit == 0) { return EMPTY_RESPONSE; } calculateDisposition(offset); return Collections.unmodifiableList(internalSearch(limit)); } RepositorySearchTaskV5_5(InternalCriteria criteria, SearchUseCase searchUseCase); }
RepositorySearchTaskV5_5 extends RepositorySearchTask { @NotNull @Override public List<Resource> nextLookup() throws ServiceException { int limit = mInitialCriteria.getLimit(); int offset = mInitialCriteria.getOffset(); if (mEndReached || limit == 0) { return EMPTY_RESPONSE; } calculateDisposition(offset); return Collections.unmodifiableList(internalSearch(limit)); } RepositorySearchTaskV5_5(InternalCriteria criteria, SearchUseCase searchUseCase); @NotNull @Override List<Resource> nextLookup(); @Override boolean hasNext(); }
RepositorySearchTaskV5_5 extends RepositorySearchTask { @NotNull @Override public List<Resource> nextLookup() throws ServiceException { int limit = mInitialCriteria.getLimit(); int offset = mInitialCriteria.getOffset(); if (mEndReached || limit == 0) { return EMPTY_RESPONSE; } calculateDisposition(offset); return Collections.unmodifiableList(internalSearch(limit)); } RepositorySearchTaskV5_5(InternalCriteria criteria, SearchUseCase searchUseCase); @NotNull @Override List<Resource> nextLookup(); @Override boolean hasNext();  }