use of com.linkedin.restli.examples.greetings.api.MessageCriteriaArray in project rest.li by linkedin.
the class TestParseqBasedFluentClientApi method testAssociationBatchFinderUsingAssocKey.
@Test
public void testAssociationBatchFinderUsingAssocKey() throws Exception {
AssociationsFluentClient associations = new AssociationsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
MessageCriteriaArray criteriaArray = new MessageCriteriaArray();
criteriaArray.add(new MessageCriteria().setTone(Tone.FRIENDLY));
criteriaArray.add(new MessageCriteria().setTone(Tone.INSULTING));
BatchCollectionResponse<Message> messages = associations.findBySearchMessages(AssociationResourceHelpers.URL_COMPOUND_KEY.getPartAsString("src"), criteriaArray).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(messages.getResults().size(), 2);
BatchFinderCriteriaResult<Message> friendly = messages.getResults().get(0);
Assert.assertFalse(friendly.isError());
for (Message message : friendly.getElements()) {
Assert.assertEquals(message.getTone(), Tone.FRIENDLY);
}
BatchFinderCriteriaResult<Message> insulting = messages.getResults().get(1);
Assert.assertTrue(insulting.isError());
Assert.assertEquals((int) insulting.getError().getStatus(), 404);
}
Aggregations