diff --git a/src/main/java/com/graqr/threshr/Threshr.java b/src/main/java/com/graqr/threshr/Threshr.java index f347d6a..2ddb437 100644 --- a/src/main/java/com/graqr/threshr/Threshr.java +++ b/src/main/java/com/graqr/threshr/Threshr.java @@ -94,7 +94,7 @@ public List 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; } diff --git a/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy b/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy index f0d2a62..0956454 100644 --- a/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy +++ b/src/test/groovy/com/graqr/threshr/ThreshrControllerSpec.groovy @@ -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() }}