use of com.linkedin.restli.client.testutils.MockFailedResponseFutureBuilder in project rest.li by linkedin.
the class TestMockFailedResponseFutureBuilder method buildWithErrorResponse.
private ResponseFuture<Greeting> buildWithErrorResponse(ErrorHandlingBehavior errorHandlingBehavior) {
MockFailedResponseFutureBuilder<Long, Greeting> builder = new MockFailedResponseFutureBuilder<Long, Greeting>();
ErrorResponse errorResponse = new ErrorResponse().setStatus(404).setMessage("foo");
builder.setErrorResponse(errorResponse).setErrorHandlingBehavior(errorHandlingBehavior);
return builder.build();
}
use of com.linkedin.restli.client.testutils.MockFailedResponseFutureBuilder in project rest.li by linkedin.
the class TestMockFailedResponseFutureBuilder method testOnlyOneOfErrorResponseOrEntityIsSet.
@Test
public void testOnlyOneOfErrorResponseOrEntityIsSet() {
MockFailedResponseFutureBuilder<Long, Greeting> builder = new MockFailedResponseFutureBuilder<Long, Greeting>();
builder.setEntity(new Greeting());
try {
builder.setErrorResponse(new ErrorResponse());
Assert.fail();
} catch (IllegalStateException e) {
// expected
}
builder = new MockFailedResponseFutureBuilder<Long, Greeting>();
builder.setErrorResponse(new ErrorResponse());
try {
builder.setEntity(new Greeting());
Assert.fail();
} catch (IllegalStateException e) {
// expected
}
}
use of com.linkedin.restli.client.testutils.MockFailedResponseFutureBuilder in project rest.li by linkedin.
the class TestMockFailedResponseFutureBuilder method testBuildIllegalStatus.
@Test
@SuppressWarnings("rawtypes")
public void testBuildIllegalStatus() {
MockFailedResponseFutureBuilder builder = new MockFailedResponseFutureBuilder();
try {
builder.setStatus(200);
Assert.fail("Setting a 2xx status should have failed!");
} catch (IllegalArgumentException e) {
// expected
}
}
use of com.linkedin.restli.client.testutils.MockFailedResponseFutureBuilder in project rest.li by linkedin.
the class TestMockFailedResponseFutureBuilder method buildWithEntity.
private ResponseFuture<Greeting> buildWithEntity(ErrorHandlingBehavior errorHandlingBehavior) {
MockFailedResponseFutureBuilder<Long, Greeting> builder = new MockFailedResponseFutureBuilder<Long, Greeting>();
Greeting greeting = new Greeting().setId(1L).setMessage("foo");
builder.setEntity(greeting).setErrorHandlingBehavior(errorHandlingBehavior).setStatus(500);
return builder.build();
}
Aggregations