Search in sources :

Example 1 with EmptyUnionRequestBuilders

use of com.linkedin.restli.examples.greetings.client.EmptyUnionRequestBuilders 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);
}
Also used : ValidateEmptyUnion(com.linkedin.restli.examples.greetings.api.ValidateEmptyUnion) EmptyUnionRequestBuilders(com.linkedin.restli.examples.greetings.client.EmptyUnionRequestBuilders) PathSpec(com.linkedin.data.schema.PathSpec) Test(org.testng.annotations.Test)

Example 2 with EmptyUnionRequestBuilders

use of com.linkedin.restli.examples.greetings.client.EmptyUnionRequestBuilders 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();
}
Also used : ValidateEmptyUnion(com.linkedin.restli.examples.greetings.api.ValidateEmptyUnion) EmptyUnionRequestBuilders(com.linkedin.restli.examples.greetings.client.EmptyUnionRequestBuilders) Test(org.testng.annotations.Test)

Example 3 with EmptyUnionRequestBuilders

use of com.linkedin.restli.examples.greetings.client.EmptyUnionRequestBuilders 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();
}
Also used : ValidateEmptyUnion(com.linkedin.restli.examples.greetings.api.ValidateEmptyUnion) EmptyUnionRequestBuilders(com.linkedin.restli.examples.greetings.client.EmptyUnionRequestBuilders) PathSpec(com.linkedin.data.schema.PathSpec) Test(org.testng.annotations.Test)

Aggregations

ValidateEmptyUnion (com.linkedin.restli.examples.greetings.api.ValidateEmptyUnion)3 EmptyUnionRequestBuilders (com.linkedin.restli.examples.greetings.client.EmptyUnionRequestBuilders)3 Test (org.testng.annotations.Test)3 PathSpec (com.linkedin.data.schema.PathSpec)2