use of com.linkedin.restli.examples.greetings.api.ValidateEmptyUnion in project rest.li by linkedin.
the class TestEmptyUnionValidation method testUnionEmptyWithProjection.
@Test
public void testUnionEmptyWithProjection() throws RemoteInvocationException {
ValidateEmptyUnion expected = new ValidateEmptyUnion();
expected.setFoo(new ValidateEmptyUnion.Foo());
List<PathSpec> spec = Collections.singletonList(ValidateEmptyUnion.fields().foo().Fuzz());
EmptyUnionRequestBuilders requestBuilders = new EmptyUnionRequestBuilders();
GetRequest<ValidateEmptyUnion> req = requestBuilders.get().id(1L).fields(spec.toArray(new PathSpec[spec.size()])).build();
ValidateEmptyUnion actual = getClient().sendRequest(req).getResponse().getEntity();
Assert.assertEquals(actual, expected);
}
use of com.linkedin.restli.examples.greetings.api.ValidateEmptyUnion in project rest.li by linkedin.
the class TestEmptyUnionValidation method testUnionEmptyWithoutProjection.
@Test(expectedExceptions = RestLiResponseException.class)
public void testUnionEmptyWithoutProjection() throws RemoteInvocationException {
String expectedSuffix = "projection";
EmptyUnionRequestBuilders requestBuilders = new EmptyUnionRequestBuilders();
GetRequest<ValidateEmptyUnion> req = requestBuilders.get().id(1L).build();
ValidateEmptyUnion res = getClient().sendRequest(req).getResponse().getEntity();
}
use of com.linkedin.restli.examples.greetings.api.ValidateEmptyUnion in project rest.li by linkedin.
the class ValidateEmptyUnionResource method get.
// write some resource method to provide the data of the ValidateEmptyUnion record
@Override
public ValidateEmptyUnion get(Long keyId) {
ValidateEmptyUnion union = new ValidateEmptyUnion();
ValidateEmptyUnion.Foo foo = new ValidateEmptyUnion.Foo();
union.setFoo(foo);
return union;
}
use of com.linkedin.restli.examples.greetings.api.ValidateEmptyUnion in project rest.li by linkedin.
the class TestEmptyUnionValidation method testFailValidationWithFullUnionMemberProjection.
@Test(expectedExceptions = RestLiResponseException.class)
public void testFailValidationWithFullUnionMemberProjection() throws RemoteInvocationException {
ValidateEmptyUnion expected = new ValidateEmptyUnion();
expected.setFoo(new ValidateEmptyUnion.Foo());
List<PathSpec> spec = Arrays.asList(ValidateEmptyUnion.fields().foo().Fuzz(), ValidateEmptyUnion.fields().foo().Bar());
EmptyUnionRequestBuilders requestBuilders = new EmptyUnionRequestBuilders();
GetRequest<ValidateEmptyUnion> req = requestBuilders.get().id(1L).fields(spec.toArray(new PathSpec[spec.size()])).build();
ValidateEmptyUnion actual = getClient().sendRequest(req).getResponse().getEntity();
}
Aggregations