Search in sources :

Example 1 with CustomStringRef

use of com.linkedin.restli.server.CustomStringRef 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);
}
Also used : CustomString(com.linkedin.restli.server.custom.types.CustomString) CustomLong(com.linkedin.restli.server.custom.types.CustomLong) CustomLongRef(com.linkedin.restli.server.CustomLongRef) CustomStringRef(com.linkedin.restli.server.CustomStringRef) Test(org.testng.annotations.Test) ArrayTest(com.linkedin.pegasus.generator.test.ArrayTest)

Aggregations

ArrayTest (com.linkedin.pegasus.generator.test.ArrayTest)1 CustomLongRef (com.linkedin.restli.server.CustomLongRef)1 CustomStringRef (com.linkedin.restli.server.CustomStringRef)1 CustomLong (com.linkedin.restli.server.custom.types.CustomLong)1 CustomString (com.linkedin.restli.server.custom.types.CustomString)1 Test (org.testng.annotations.Test)1