Search in sources :

Example 11 with ErrorResponse

use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.

the class EjbOverHttpResourceTest method assertNoError.

private static void assertNoError(Response response, Status expectedStatus) {
    if (response.getStatus() == 400) {
        ErrorResponse error = response.readEntity(ErrorResponse.class);
        fail("Remote error: " + error.toString());
    }
    if (response.getStatus() != expectedStatus.getStatusCode()) {
        fail("Unexpected status: " + response.readEntity(String.class));
    }
}
Also used : ErrorResponse(fish.payara.ejb.http.protocol.ErrorResponse)

Example 12 with ErrorResponse

use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.

the class EjbOverHttpResourceTest method invoke_ErrorNoSuchMethodWrongName.

@Test
public void invoke_ErrorNoSuchMethodWrongName() {
    ErrorResponse response = invokeExpectError(mediaType, EJB_NAME, "sub", new String[] { int.class.getName(), int.class.getName() }, pack(1, 2));
    assertEquals("java.lang.NoSuchMethodException", response.exceptionType);
    assertEquals("No method matching sub([int, int]) found in business interface", response.message);
    assertNull(response.cause);
}
Also used : ErrorResponse(fish.payara.ejb.http.protocol.ErrorResponse) Test(org.junit.Test)

Aggregations

ErrorResponse (fish.payara.ejb.http.protocol.ErrorResponse)12 Test (org.junit.Test)10 InvokeMethodResponse (fish.payara.ejb.http.protocol.InvokeMethodResponse)2 InvokeMethodRequest (fish.payara.ejb.http.protocol.InvokeMethodRequest)1 LookupResponse (fish.payara.ejb.http.protocol.LookupResponse)1 Response (javax.ws.rs.core.Response)1