Skip to content
This repository was archived by the owner on Jan 31, 2022. It is now read-only.

Commit 1994db3

Browse files
author
Clément Le Provost
committed
[test] More robust unit test on get object filtering
1 parent 2c455b2 commit 1994db3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

algoliasearch/src/test/java/com/algolia/search/saas/IndexTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public void setUp() throws Exception {
9393
client.deleteIndex(originalIndexName);
9494

9595
originalObjects = new ArrayList<>();
96-
originalObjects.add(new JSONObject("{\"city\": \"San Francisco\"}"));
97-
originalObjects.add(new JSONObject("{\"city\": \"San José\"}"));
96+
originalObjects.add(new JSONObject("{\"city\": \"San Francisco\", \"state\": \"CA\"}"));
97+
originalObjects.add(new JSONObject("{\"city\": \"San José\", \"state\": \"CA\"}"));
9898

9999
JSONObject task = originalIndex.addObjects(new JSONArray(originalObjects));
100100
originalIndex.waitTask(task.getString("taskID"));
@@ -399,12 +399,12 @@ public void getObjectAsync() throws Exception {
399399

400400
@Test
401401
public void getObjectWithAttributesToRetrieveAsync() throws Exception {
402-
List<String> attributesToRetrieve = new ArrayList<>();
403-
attributesToRetrieve.add("objectID");
402+
List<String> attributesToRetrieve = Arrays.asList("objectID", "state");
404403
index.getObjectAsync(ids.get(0), attributesToRetrieve, new AssertCompletionHandler() {
405404
@Override public void doRequestCompleted(JSONObject content, AlgoliaException error) {
406405
if (error == null) {
407406
assertTrue("Object has unexpected objectId", content.optString("objectID").equals(ids.get(0)));
407+
assertTrue("Object is missing expected 'state' attribute", content.has("state"));
408408
assertFalse("Object has unexpected 'city' attribute", content.has("city"));
409409
} else {
410410
fail(error.getMessage());

0 commit comments

Comments
 (0)