Skip to content

Commit

Permalink
fix: remove out of bound opportunity
Browse files Browse the repository at this point in the history
Signed-off-by: jonathan zollinger <jonathan.zollinger@outlook.com>
  • Loading branch information
Jonathan-Zollinger committed Jul 19, 2024
1 parent 770529a commit e668638
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/graqr/threshr/Threshr.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public List<Search> plpQuery(TargetStore pricingStore, String category) throws T
result = plpQuery(pricingStore, category, offset);
searchList.add(result);
offset ++;
} while (result.searchResponse().metadata().totalPages() >= offset);
} while (result.searchResponse().metadata().totalPages() > offset);
return searchList;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ class ThreshrControllerSpec extends ThreshrSpec {
noExceptionThrown()

and: "List size matches pagination expected size."
null != searches && searches.size() > 0 ? searches[0].searchResponse().metadata().totalPages() == searches.size() :
"Expected list size " + searches.size() + " but got " + searches[0].searchResponse().metadata().totalPages()

if (null != searches && searches.size() > 0 )
if (searches[0].searchResponse().metadata().totalPages() == 0) {
searches[0].searchResponse().metadata().totalPages() == 1
}else {
searches[0].searchResponse().metadata().totalPages() == searches.size()
}
and: "Each product object contains non-null price object."
searches.forEach {it.products().collect { null != it.price() }}

Expand Down

0 comments on commit e668638

Please sign in to comment.