use of com.linkedin.restli.client.GetRequestBuilder in project rest.li by linkedin.
the class TestTyperefCustomDoubleAssociationKeyResource method testGet.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
public void testGet(RestliRequestOptions requestOptions) throws RemoteInvocationException {
HashMap<String, CompoundKey.TypeInfo> keyParts = new HashMap<String, CompoundKey.TypeInfo>();
keyParts.put("src", new CompoundKey.TypeInfo(Double.class, Double.class));
keyParts.put("dest", new CompoundKey.TypeInfo(Double.class, Double.class));
GetRequestBuilder<CompoundKey, Message> getBuilder = new GetRequestBuilder<CompoundKey, Message>("typerefCustomDoubleAssociationKeyResource", Message.class, new ResourceSpecImpl(EnumSet.of(ResourceMethod.GET), new HashMap<String, DynamicRecordMetadata>(), new HashMap<String, DynamicRecordMetadata>(), CompoundKey.class, null, null, Message.class, keyParts), requestOptions);
final String[] stringArray = { "foo" };
GetRequest<Message> req = getBuilder.id(new CompoundKey().append("src", 100.0).append("dest", 200.0)).setReqParam("array", stringArray).build();
Response<Message> resp = REST_CLIENT.sendRequest(req).getResponse();
Message result = resp.getEntity();
Assert.assertEquals(result.getId(), "100.0->200.0");
Assert.assertEquals(result.getMessage(), String.format("I need some $20. Array contents %s.", Arrays.asList(stringArray)));
}
Aggregations