Search in sources :

Example 1 with RestError

use of ajsc.exceptions.RestError in project AJSC by att.

the class RefresheableRESTErrorMapTest method shouldReturnSOAPDataError.

@Test
public void shouldReturnSOAPDataError() {
    RestError error = RefresheableRESTErrorMap.getHttpCodeForCSIError("300");
    assertEquals(HttpServletResponse.SC_BAD_REQUEST, error.status);
    assertEquals("SVC3000", error.MessageId);
    assertEquals("A data error has occurred: %1", error.Message);
}
Also used : RestError(ajsc.exceptions.RestError) Test(org.junit.Test)

Example 2 with RestError

use of ajsc.exceptions.RestError in project AJSC by att.

the class RefresheableRESTErrorMapTest method shouldReturnCSIXMLRequestError.

@Test
public void shouldReturnCSIXMLRequestError() {
    RestError error = RefresheableRESTErrorMap.getHttpCodeForCSIError("400");
    assertEquals(HttpServletResponse.SC_BAD_REQUEST, error.status);
    assertEquals("SVC4000", error.MessageId);
    assertEquals("The request is invalid: %1", error.Message);
}
Also used : RestError(ajsc.exceptions.RestError) Test(org.junit.Test)

Example 3 with RestError

use of ajsc.exceptions.RestError in project AJSC by att.

the class RefresheableRESTErrorMapTest method shouldReturnSOAPServiceUnavailableError.

@Test
public void shouldReturnSOAPServiceUnavailableError() {
    RestError error = RefresheableRESTErrorMap.getHttpCodeForCSIError("200");
    assertEquals(HttpServletResponse.SC_SERVICE_UNAVAILABLE, error.status);
    assertEquals("SVC2000", error.MessageId);
    assertEquals("A resource required by the service is unavailable: %1", error.Message);
}
Also used : RestError(ajsc.exceptions.RestError) Test(org.junit.Test)

Example 4 with RestError

use of ajsc.exceptions.RestError in project AJSC by att.

the class RefresheableRESTErrorMapTest method shouldReturnSOAPAuthError.

@Test
public void shouldReturnSOAPAuthError() {
    RestError error = RefresheableRESTErrorMap.getHttpCodeForCSIError("100");
    assertEquals(HttpServletResponse.SC_FORBIDDEN, error.status);
    assertEquals("POL1000", error.MessageId);
    assertEquals("The operation is not allowed: %1", error.Message);
}
Also used : RestError(ajsc.exceptions.RestError) Test(org.junit.Test)

Example 5 with RestError

use of ajsc.exceptions.RestError in project AJSC by att.

the class RefresheableRESTErrorMapTest method shouldReturnInternalServerError.

@Test
public void shouldReturnInternalServerError() {
    RestError error = RefresheableRESTErrorMap.getHttpCodeForCSIError("999");
    assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, error.status);
    assertEquals("SVC9999", error.MessageId);
    assertEquals("An internal error has occurred: %1", error.Message);
}
Also used : RestError(ajsc.exceptions.RestError) Test(org.junit.Test)

Aggregations

RestError (ajsc.exceptions.RestError)9 Test (org.junit.Test)7 CSIRESTException (ajsc.exceptions.CSIRESTException)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 HashMap (java.util.HashMap)1