Search in sources :

Example 1 with AsyncErrorsBuilders

use of com.linkedin.restli.examples.greetings.client.AsyncErrorsBuilders in project rest.li by linkedin.

the class TestAsyncExceptions method testCallback.

@Test(dataProvider = "exceptionProvider")
public void testCallback(String key, int expectedStatus) throws RemoteInvocationException {
    AsyncErrorsBuilders builder = new AsyncErrorsBuilders();
    Request<Greeting> request = builder.actionCallback().paramId(key).build();
    try {
        getClient().sendRequest(request).getResponse();
        Assert.fail("This request should have failed.");
    } catch (RestLiResponseException e) {
        Assert.assertEquals(e.getStatus(), expectedStatus);
    }
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) AsyncErrorsBuilders(com.linkedin.restli.examples.greetings.client.AsyncErrorsBuilders) RestLiResponseException(com.linkedin.restli.client.RestLiResponseException) Test(org.testng.annotations.Test)

Example 2 with AsyncErrorsBuilders

use of com.linkedin.restli.examples.greetings.client.AsyncErrorsBuilders in project rest.li by linkedin.

the class TestAsyncExceptions method testTask.

@Test(dataProvider = "exceptionProvider")
public void testTask(String key, int expectedStatus) throws RemoteInvocationException {
    AsyncErrorsBuilders builder = new AsyncErrorsBuilders();
    Request<Greeting> request = builder.actionTask().paramId(key).build();
    try {
        getClient().sendRequest(request).getResponse();
        Assert.fail("This request should have failed.");
    } catch (RestLiResponseException e) {
        Assert.assertEquals(e.getStatus(), expectedStatus);
    }
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) AsyncErrorsBuilders(com.linkedin.restli.examples.greetings.client.AsyncErrorsBuilders) RestLiResponseException(com.linkedin.restli.client.RestLiResponseException) Test(org.testng.annotations.Test)

Example 3 with AsyncErrorsBuilders

use of com.linkedin.restli.examples.greetings.client.AsyncErrorsBuilders in project rest.li by linkedin.

the class TestAsyncExceptions method testPromise.

@Test(dataProvider = "exceptionProvider")
public void testPromise(String key, int expectedStatus) throws RemoteInvocationException {
    AsyncErrorsBuilders builder = new AsyncErrorsBuilders();
    Request<Greeting> request = builder.actionPromise().paramId(key).build();
    try {
        getClient().sendRequest(request).getResponse();
        Assert.fail("This request should have failed.");
    } catch (RestLiResponseException e) {
        Assert.assertEquals(e.getStatus(), expectedStatus);
    }
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) AsyncErrorsBuilders(com.linkedin.restli.examples.greetings.client.AsyncErrorsBuilders) RestLiResponseException(com.linkedin.restli.client.RestLiResponseException) Test(org.testng.annotations.Test)

Aggregations

RestLiResponseException (com.linkedin.restli.client.RestLiResponseException)3 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)3 AsyncErrorsBuilders (com.linkedin.restli.examples.greetings.client.AsyncErrorsBuilders)3 Test (org.testng.annotations.Test)3