File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
integrationTest/groovy/com/bol/openapi
main/java/com/bol/openapi Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,33 @@ class OpenApiClientIntegrationSpec extends Specification {
101101 product. offerData. offers. size() >= 1
102102 }
103103
104+ def ' Return products and categories' () {
105+ def results = OpenApiClient . withDefaultClient(apiKey). searchBuilder()
106+ .term(' harry potter' )
107+ .dataType(QueryDataType.DataType . PRODUCTS )
108+ .dataType(QueryDataType.DataType . CATEGORIES )
109+ .search()
110+
111+ expect :
112+ results. totalResultSize >= 1
113+ results. products. size() > 0
114+ results. categories. size() > 0
115+ results. refinementGroups. size() == 0
116+ }
117+
118+ def ' Return only refinements' () {
119+ def results = OpenApiClient . withDefaultClient(apiKey). searchBuilder()
120+ .term(' harry potter' )
121+ .dataType(QueryDataType.DataType . REFINEMENTS )
122+ .search()
123+
124+ expect :
125+ results. totalResultSize >= 1
126+ results. products. size() == 0
127+ results. categories. size() == 0
128+ results. refinementGroups. size() > 0
129+ }
130+
104131 def ' Can find out if the OpenAPI is healthy' () {
105132 def status = OpenApiClient . withDefaultClient(apiKey). getHealthStatus()
106133
Original file line number Diff line number Diff line change @@ -55,6 +55,11 @@ public SearchBuilder category(String id) {
5555 return new SearchBuilder (this );
5656 }
5757
58+ public SearchBuilder dataType (QueryDataType .DataType dataType ) {
59+ dataTypes .add (dataType );
60+ return new SearchBuilder (this );
61+ }
62+
5863 public SearchBuilder allOffers () {
5964 offerTypes .add (ALL );
6065 return new SearchBuilder (this );
You can’t perform that action at this time.
0 commit comments