Search in sources :

Example 1 with RestException

use of com.yahoo.pulsar.discovery.service.web.RestException in project pulsar by yahoo.

the class DiscoveryServiceWebTest method testException.

@Test
public void testException() {
    RestException exception1 = new RestException(BAD_GATEWAY, "test-msg");
    assertTrue(exception1.getMessage().contains(BAD_GATEWAY.toString()));
    RestException exception2 = new RestException(BAD_GATEWAY.getStatusCode(), "test-msg");
    assertTrue(exception2.getMessage().contains(BAD_GATEWAY.toString()));
    RestException exception3 = new RestException(exception2);
    assertTrue(exception3.getMessage().contains(INTERNAL_SERVER_ERROR.toString()));
    assertTrue(RestException.getExceptionData(exception2).contains(BAD_GATEWAY.toString()));
}
Also used : RestException(com.yahoo.pulsar.discovery.service.web.RestException) Test(org.testng.annotations.Test)

Aggregations

RestException (com.yahoo.pulsar.discovery.service.web.RestException)1 Test (org.testng.annotations.Test)1