use of com.linkedin.restli.common.MyCustomString in project rest.li by linkedin.
the class TestResponseUtils method testConvertCustomTyperefKey.
public void testConvertCustomTyperefKey() {
MyCustomString customStringKey = (MyCustomString) ResponseUtils.convertKey("foo", TypeSpec.forClassMaybeNull(MyCustomStringRef.class), null, null, AllProtocolVersions.BASELINE_PROTOCOL_VERSION);
Assert.assertEquals(customStringKey, new MyCustomString("foo"));
}
use of com.linkedin.restli.common.MyCustomString in project rest.li by linkedin.
the class TestMockBatchCreateIdResponseFactory method provideKeys.
@DataProvider
public Object[][] provideKeys() {
Greeting g1 = buildGreeting(1L);
Greeting g2 = buildGreeting(2L);
Greeting g3 = buildGreeting(3L);
return new Object[][] { new Object[] { new Long[] { 1L, 2L, 3L } }, new Object[] { new MyCustomString[] { new MyCustomString("1"), new MyCustomString("2"), new MyCustomString("3") } }, new Object[] { new CompoundKey[] { buildCompoundKey("c1", 1), buildCompoundKey("c2", 2), buildCompoundKey("c3", 3) } }, new Object[] { new ComplexResourceKey<?, ?>[] { new ComplexResourceKey<Greeting, Greeting>(g1, g1), new ComplexResourceKey<Greeting, Greeting>(g2, g2), new ComplexResourceKey<Greeting, Greeting>(g3, g3) } } };
}
use of com.linkedin.restli.common.MyCustomString in project rest.li by linkedin.
the class TestMockBatchKVResponseFactory method customPrimitiveTyperefKeyData.
@DataProvider(name = "customPrimitiveTyperefKey")
public Object[][] customPrimitiveTyperefKeyData() {
MyCustomString m1 = new MyCustomString("1");
MyCustomString m2 = new MyCustomString("2");
MyCustomString m3 = new MyCustomString("3");
Map<MyCustomString, Greeting> recordTemplates = new HashMap<MyCustomString, Greeting>();
Map<MyCustomString, ErrorResponse> errorResponses = new HashMap<MyCustomString, ErrorResponse>();
recordTemplates.put(m1, buildGreeting(1L));
recordTemplates.put(m2, buildGreeting(2L));
errorResponses.put(m3, new ErrorResponse().setMessage("3"));
Map<MyCustomString, HttpStatus> statuses = new HashMap<MyCustomString, HttpStatus>();
statuses.put(m1, HttpStatus.S_200_OK);
statuses.put(m2, HttpStatus.S_200_OK);
statuses.put(m3, HttpStatus.S_500_INTERNAL_SERVER_ERROR);
Map<MyCustomString, EntityResponse<Greeting>> expectedResults = new HashMap<MyCustomString, EntityResponse<Greeting>>();
expectedResults.put(m1, buildEntityResponse(recordTemplates.get(m1), HttpStatus.S_200_OK, null));
expectedResults.put(m2, buildEntityResponse(recordTemplates.get(m2), HttpStatus.S_200_OK, null));
expectedResults.put(m3, buildEntityResponse(null, HttpStatus.S_500_INTERNAL_SERVER_ERROR, errorResponses.get(m3)));
return new Object[][] { { recordTemplates, statuses, errorResponses, expectedResults } };
}
Aggregations