use of com.linkedin.restli.server.custom.types.CustomString in project rest.li by linkedin.
the class TestRestLiMethodInvocation method testCustomTypeParametersCustomString.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "customStringParam")
public void testCustomTypeParametersCustomString(ProtocolVersion version, String uri) throws Exception {
ResourceModel repliesResourceModel = buildResourceModel(RepliesCollectionResource.class);
ResourceMethodDescriptor methodDescriptor = repliesResourceModel.findFinderMethod("customString");
RepliesCollectionResource repliesResource = getMockResource(RepliesCollectionResource.class);
repliesResource.customString(new CustomString("foo"));
EasyMock.expectLastCall().andReturn(null).once();
checkInvocation(repliesResource, methodDescriptor, "GET", version, uri);
}
use of com.linkedin.restli.server.custom.types.CustomString in project rest.li by linkedin.
the class TestConvertSimpleValue method testConvertCustomString.
@Test
public void testConvertCustomString() {
CustomString forceRegistration = new CustomString("");
Class<?> customStringClass = CustomString.class;
Object convertedCustomString = ArgumentUtils.convertSimpleValue("aString", DataTemplateUtil.getSchema(CustomStringRef.class), customStringClass);
Assert.assertTrue(convertedCustomString.getClass().equals(customStringClass));
CustomString customString = (CustomString) convertedCustomString;
Assert.assertTrue(customString.toString().equals("aString"));
}
use of com.linkedin.restli.server.custom.types.CustomString in project rest.li by linkedin.
the class TestParameterDefaultValue method testCustomParams.
@Test
public void testCustomParams() {
// Initialize the custom class to ensure the coercer is registered.
Custom.initializeCustomClass(CustomString.class);
Object result = test("custom string ref", CustomString.class, new CustomStringRef().getSchema());
final CustomString expectedCustomString = new CustomString("custom string ref");
Assert.assertEquals(result, expectedCustomString);
Assert.assertSame(result.getClass(), CustomString.class);
result = test("12345", CustomLong.class, new CustomLongRef().getSchema());
final CustomLong expectedCustomLong = new CustomLong(12345L);
Assert.assertEquals(result, expectedCustomLong);
Assert.assertSame(result.getClass(), CustomLong.class);
}
Aggregations