Example usage:
*JSONObject object = new JSonObject();*
object.put("taxonomies.color", Object)
- * Taxonomy taxonomy = stack("authtoken").taxonomy("taxonomyId").filterTaxonomy(object);
+ * Taxonomy taxonomy = stack("authtoken").taxonomy("taxonomyId").query(object);
*
* @param query the query of type @{@link JSONObject}
* @return instance of {@link Call}
diff --git a/src/test/java/com/contentstack/cms/stack/AssetAPITest.java b/src/test/java/com/contentstack/cms/stack/AssetAPITest.java
index c4df3ca2..c64b1a8b 100644
--- a/src/test/java/com/contentstack/cms/stack/AssetAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/AssetAPITest.java
@@ -30,7 +30,7 @@ static void setup() {
@Order(1)
@Test
- void testFindAssets() throws IOException {
+ void testFindAssets() {
asset.clearParams();
asset.addParam("include_folders", true);
asset.addParam("environment", "production");
@@ -141,10 +141,9 @@ void testAssetUpload() {
asset.addHeader("api_key", API_KEY);
asset.addHeader("authorization", MANAGEMENT_TOKEN);
asset.addHeader("authtoken", AUTHTOKEN);
- String filePath = "/Users/shaileshmishra/Desktop/pexels.png";
- String description = "The calender has been placed to assets by ishaileshmishra";
+ String filePath = "/Users/shaileshmishra/Desktop/image.jpeg";
+ String description = "The calender has been placed to assets by shaileshmishra";
Request request = asset.uploadAsset(filePath, description).request();
-
// The assertions
Assertions.assertEquals(3, request.headers().size());
Assertions.assertTrue(request.headers().names().contains("api_key"));
diff --git a/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java b/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
index 07281882..981635a0 100644
--- a/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
@@ -2,8 +2,10 @@
import com.contentstack.cms.TestClient;
import okhttp3.Request;
+import okhttp3.ResponseBody;
import org.json.simple.JSONObject;
import org.junit.jupiter.api.*;
+import retrofit2.Response;
import java.io.IOException;
@@ -363,4 +365,24 @@ void testPublishWithReference() {
request.url().toString());
}
+
+ @Test
+ public void testEntryQuery() {
+ JSONObject query = new JSONObject();
+ query.put("taxonomies.taxonomy_uid", "{ \"$in\" : [\"term_uid1\" , \"term_uid2\" ] }");
+ Request request = entry.query(query).request();
+ Assertions.assertEquals(2, request.headers().names().size());
+ Assertions.assertEquals("GET", request.method());
+ Assertions.assertTrue(request.url().isHttps());
+ Assertions.assertEquals("api.contentstack.io", request.url().host());
+ Assertions.assertEquals(4, request.url().pathSegments().size());
+ Assertions.assertEquals("v3", request.url().pathSegments().get(0));
+ Assertions.assertEquals("content_types", request.url().pathSegments().get(1));
+ Assertions.assertEquals("product", request.url().pathSegments().get(2));
+ Assertions.assertEquals("entries", request.url().pathSegments().get(3));
+ Assertions.assertNull(request.body());
+ Assertions.assertEquals("query={\"taxonomies.taxonomy_uid\":\"{ \\\"$in\\\" : [\\\"term_uid1\\\" , \\\"term_uid2\\\" ] }\"}", request.url().query());
+
+ }
+
}