use of com.linkedin.restli.common.validation.RestLiDataValidator in project rest.li by linkedin.
the class TestRestLiValidationFromClient method testInvalidOutputEntityValidation.
@Test
public void testInvalidOutputEntityValidation() {
RestLiDataValidator validator = new RestLiDataValidator(Collections.<String, List<String>>emptyMap(), ValidationDemo.class, ResourceMethod.GET);
try {
validator.validateOutput(null);
Assert.fail("Expected IllegalArgumentException.");
} catch (IllegalArgumentException e) {
Assert.assertEquals(e.getMessage(), "Record template is null.");
}
try {
validator.validateOutput(new ValidationDemo(null));
Assert.fail("Expected IllegalArgumentException.");
} catch (IllegalArgumentException e) {
Assert.assertEquals(e.getMessage(), "Record template does not have data.");
}
}
Aggregations