Search in sources :

Example 1 with MockRestliResponseExceptionBuilder

use of com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder in project rest.li by linkedin.

the class TestMockRestliResponseExceptionBuilder method testNullCookies.

@Test(expectedExceptions = IllegalArgumentException.class)
public void testNullCookies() {
    MockRestliResponseExceptionBuilder exceptionBuilder = new MockRestliResponseExceptionBuilder();
    exceptionBuilder.setCookies(null);
}
Also used : MockRestliResponseExceptionBuilder(com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder) Test(org.testng.annotations.Test)

Example 2 with MockRestliResponseExceptionBuilder

use of com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder in project rest.li by linkedin.

the class TestMockRestliResponseExceptionBuilder method testNullProtocolVersion.

@Test(expectedExceptions = IllegalArgumentException.class)
public void testNullProtocolVersion() {
    MockRestliResponseExceptionBuilder exceptionBuilder = new MockRestliResponseExceptionBuilder();
    exceptionBuilder.setProtocolVersion(null);
}
Also used : MockRestliResponseExceptionBuilder(com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder) Test(org.testng.annotations.Test)

Example 3 with MockRestliResponseExceptionBuilder

use of com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder in project rest.li by linkedin.

the class TestMockRestliResponseExceptionBuilder method testNullStatus.

@Test(expectedExceptions = IllegalArgumentException.class)
public void testNullStatus() {
    MockRestliResponseExceptionBuilder exceptionBuilder = new MockRestliResponseExceptionBuilder();
    exceptionBuilder.setStatus(null);
}
Also used : MockRestliResponseExceptionBuilder(com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder) Test(org.testng.annotations.Test)

Example 4 with MockRestliResponseExceptionBuilder

use of com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder in project rest.li by linkedin.

the class TestMockRestliResponseExceptionBuilder method testNullHeaders.

@Test(expectedExceptions = IllegalArgumentException.class)
public void testNullHeaders() {
    MockRestliResponseExceptionBuilder exceptionBuilder = new MockRestliResponseExceptionBuilder();
    exceptionBuilder.setHeaders(null);
}
Also used : MockRestliResponseExceptionBuilder(com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder) Test(org.testng.annotations.Test)

Example 5 with MockRestliResponseExceptionBuilder

use of com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder in project rest.li by linkedin.

the class TestMockRestliResponseExceptionBuilder method testBuildDefaults.

@Test
public void testBuildDefaults() {
    RestLiResponseException exception = new MockRestliResponseExceptionBuilder().build();
    RestResponse errorResponse = exception.getResponse();
    assertEquals(exception.getStatus(), 500);
    assertEquals(errorResponse.getHeader(RestConstants.HEADER_RESTLI_ERROR_RESPONSE), "true");
    assertEquals(errorResponse.getHeader(RestConstants.HEADER_RESTLI_PROTOCOL_VERSION), AllProtocolVersions.LATEST_PROTOCOL_VERSION.toString());
    assertTrue(errorResponse.getCookies().isEmpty());
}
Also used : RestResponse(com.linkedin.r2.message.rest.RestResponse) RestLiResponseException(com.linkedin.restli.client.RestLiResponseException) MockRestliResponseExceptionBuilder(com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder) Test(org.testng.annotations.Test)

Aggregations

MockRestliResponseExceptionBuilder (com.linkedin.restli.client.testutils.MockRestliResponseExceptionBuilder)10 Test (org.testng.annotations.Test)10 RestLiResponseException (com.linkedin.restli.client.RestLiResponseException)5 RestResponse (com.linkedin.r2.message.rest.RestResponse)3 ErrorResponse (com.linkedin.restli.common.ErrorResponse)1 ProtocolVersion (com.linkedin.restli.common.ProtocolVersion)1 HttpCookie (java.net.HttpCookie)1 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1