use of com.linkedin.restli.examples.defaults.api.RecordCriteria in project rest.li by linkedin.
the class TestFillInDefaultValue method testFillInDefaultBatchFinder.
@Test(dataProvider = "testBatchFinderData")
public void testFillInDefaultBatchFinder(Object[] criteria, HighLevelRecordWithDefault[] expected) throws RemoteInvocationException {
FillInDefaultsRequestBuilders builders = new FillInDefaultsRequestBuilders();
BatchFindRequest<HighLevelRecordWithDefault> request = builders.batchFindBySearchRecords().addCriteriaParam((RecordCriteria) criteria[0]).addCriteriaParam((RecordCriteria) criteria[1]).setParam(RestConstants.FILL_IN_DEFAULTS_PARAM, true).build();
List<BatchFinderCriteriaResult<HighLevelRecordWithDefault>> batchFinderCriteriaResults = getClient().sendRequest(request).getResponse().getEntity().getResults();
Set<HighLevelRecordWithDefault> actualActionResponse = new HashSet<>();
for (BatchFinderCriteriaResult<HighLevelRecordWithDefault> result : batchFinderCriteriaResults) {
actualActionResponse.addAll(result.getElements());
}
Set<HighLevelRecordWithDefault> expectedActionResponse = new HashSet<>(Arrays.asList(expected));
Assert.assertEquals(actualActionResponse, expectedActionResponse);
}
use of com.linkedin.restli.examples.defaults.api.RecordCriteria in project rest.li by linkedin.
the class TestFillInDefaultValue method testBatchFinderData.
@DataProvider(name = "testBatchFinderData")
private Object[][] testBatchFinderData() throws CloneNotSupportedException {
HighLevelRecordWithDefault expected1 = new HighLevelRecordWithDefault(expectedTestData.clone()).setNoDefaultFieldA(1);
HighLevelRecordWithDefault expected2 = new HighLevelRecordWithDefault(expectedTestData.clone()).setNoDefaultFieldA(2);
return new Object[][] { { new RecordCriteria[] { new RecordCriteria().setIntWithoutDefault(1), new RecordCriteria().setIntWithoutDefault(2) }, new HighLevelRecordWithDefault[] { expected1, expected2 } } };
}
Aggregations