File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
src/test/java/com/commercetools/sdk/examples Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 4646 <artifactId >commercetools-sdk-java-api-models_cart</artifactId >
4747 <version >${commercetools.version} </version >
4848 </dependency >
49+ <dependency >
50+ <groupId >com.commercetools.sdk</groupId >
51+ <artifactId >commercetools-sdk-java-api-models_category</artifactId >
52+ <version >${commercetools.version} </version >
53+ </dependency >
54+ <dependency >
55+ <groupId >com.commercetools.sdk</groupId >
56+ <artifactId >commercetools-sdk-java-api-predicates</artifactId >
57+ <version >${commercetools.version} </version >
58+ </dependency >
4959 <dependency >
5060 <groupId >com.commercetools.sdk</groupId >
5161 <artifactId >commercetools-http-client</artifactId >
Original file line number Diff line number Diff line change 33import com .commercetools .api .client .ProjectApiRoot ;
44import com .commercetools .api .defaultconfig .ApiRootBuilder ;
55import com .commercetools .api .defaultconfig .ServiceRegion ;
6+ import com .commercetools .api .models .category .CategoryPagedQueryResponse ;
67import com .commercetools .api .models .project .Project ;
78import io .vrap .rmf .base .client .oauth2 .ClientCredentials ;
89import org .junit .jupiter .api .Assertions ;
@@ -26,4 +27,21 @@ public void project() {
2627
2728 Assertions .assertEquals (System .getenv ("CTP_PROJECT_KEY" ), response .getKey ());
2829 }
30+
31+ @ Test
32+ public void category () {
33+ ProjectApiRoot apiRoot = ApiRootBuilder .of ().defaultClient (
34+ ClientCredentials .of ().withClientId (System .getenv ("CTP_CLIENT_ID" ))
35+ .withClientSecret (System .getenv ("CTP_CLIENT_SECRET" ))
36+ .build (),
37+ ServiceRegion .valueOf (Optional .ofNullable (System .getenv ("CTP_SERVICE_REGION" )).orElse ("GCP_EUROPE_WEST1" ))).build (System .getenv ("CTP_PROJECT_KEY" ));
38+
39+ CategoryPagedQueryResponse response = apiRoot
40+ .categories ()
41+ .get ()
42+ .addLimit (500 )
43+ .executeBlocking ().getBody ();
44+
45+ Assertions .assertNotNull (response );
46+ }
2947}
You can’t perform that action at this time.
0 commit comments