@@ -93,8 +93,8 @@ public void setUp() throws Exception {
93
93
client .deleteIndex (originalIndexName );
94
94
95
95
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 \" }" ));
98
98
99
99
JSONObject task = originalIndex .addObjects (new JSONArray (originalObjects ));
100
100
originalIndex .waitTask (task .getString ("taskID" ));
@@ -399,12 +399,12 @@ public void getObjectAsync() throws Exception {
399
399
400
400
@ Test
401
401
public void getObjectWithAttributesToRetrieveAsync () throws Exception {
402
- List <String > attributesToRetrieve = new ArrayList <>();
403
- attributesToRetrieve .add ("objectID" );
402
+ List <String > attributesToRetrieve = Arrays .asList ("objectID" , "state" );
404
403
index .getObjectAsync (ids .get (0 ), attributesToRetrieve , new AssertCompletionHandler () {
405
404
@ Override public void doRequestCompleted (JSONObject content , AlgoliaException error ) {
406
405
if (error == null ) {
407
406
assertTrue ("Object has unexpected objectId" , content .optString ("objectID" ).equals (ids .get (0 )));
407
+ assertTrue ("Object is missing expected 'state' attribute" , content .has ("state" ));
408
408
assertFalse ("Object has unexpected 'city' attribute" , content .has ("city" ));
409
409
} else {
410
410
fail (error .getMessage ());
0 commit comments