Skip to content

Commit

Permalink
[1134] Allow the response type to be either 400 or 500. In Jakarta RE…
Browse files Browse the repository at this point in the history
…STful Web Services 3.1 a default ExceptionMapper is required. The suggestion of the specification is to return 500 as the response status.

Signed-off-by: James R. Perkins <jperkins@redhat.com>
  • Loading branch information
jamezp committed Nov 1, 2022
1 parent 0c5fd17 commit 4dc0def
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -23,6 +23,7 @@
import java.security.Signature;
import java.security.spec.ECGenParameterSpec;
import java.util.Base64;
import java.util.List;

import ee.jakarta.tck.core.rest.JaxRsActivator;
import jakarta.json.bind.spi.JsonbProvider;
Expand Down Expand Up @@ -144,7 +145,9 @@ public void testMissingClientSerializationWithCDIProvider(TestReporter reporter)
.invoke();

System.out.printf("Response(%d), reason=%s\n", response.getStatus(), response.getStatusInfo().getReasonPhrase());
Assertions.assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
final List<Integer> expected = List.of(Response.Status.BAD_REQUEST.getStatusCode(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
Assertions.assertTrue(expected.contains(response.getStatus()),
() -> String.format("Expected one of %s got %d: %s", expected, response.getStatus(), response.readEntity(String.class)));
}

}
Expand Down

0 comments on commit 4dc0def

Please sign in to comment.