use of jakarta.ws.rs.core.NoContentException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method clientIntegerProviderTest.
/*
* @testName: clientIntegerProviderTest
*
* @assertion_ids: JAXRS:JAVADOC:863;
*
* @test_Strategy: Integer, text/plain media type
*
* the pre-packaged primitive type MessageBodyReader implementations MUST
* throw a NoContentException for zero-length message entities.
*
* readEntity throws Processing Exception
*/
@Test
@Tag("xml_binding")
public void clientIntegerProviderTest() throws Fault {
setProperty(Property.REQUEST, buildRequest(Request.GET, "entity"));
invoke();
Response response = getResponse();
response.getHeaders().add(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN_TYPE);
try {
Integer entity = getResponseBody(Integer.class);
fault("No expcetion thrown and entity is", entity);
} catch (Exception e) {
ProcessingException p = assertCause(e, ProcessingException.class, "Processing exception has not been thrown", e);
NoContentException nce = assertCause(e, NoContentException.class, "NoContentException has not been thrown", p);
logMsg("Found expected NoContentException", nce);
}
}
use of jakarta.ws.rs.core.NoContentException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method clientBooleanProviderTest.
/*
* @testName: clientBooleanProviderTest
*
* @assertion_ids: JAXRS:JAVADOC:863;
*
* @test_Strategy: Boolean, text/plain media type
*
* the pre-packaged primitive type MessageBodyReader implementations MUST
* throw a NoContentException for zero-length message entities.
*
* readEntity throws Processing Exception
*/
@Test
@Tag("xml_binding")
public void clientBooleanProviderTest() throws Fault {
setProperty(Property.REQUEST, buildRequest(Request.GET, "entity"));
invoke();
Response response = getResponse();
response.getHeaders().add(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN_TYPE);
try {
Boolean entity = getResponseBody(Boolean.class);
fault("No expcetion thrown and entity is", entity);
} catch (Exception e) {
ProcessingException p = assertCause(e, ProcessingException.class, "Processing exception has not been thrown", e);
NoContentException nce = assertCause(e, NoContentException.class, "NoContentException has not been thrown", p);
logMsg("Found expected NoContentException", nce);
}
}
use of jakarta.ws.rs.core.NoContentException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method clientCharProviderTest.
/*
* @testName: clientCharProviderTest
*
* @assertion_ids: JAXRS:JAVADOC:863;
*
* @test_Strategy: Character, text/plain media type
*
* the pre-packaged primitive type MessageBodyReader implementations MUST
* throw a NoContentException for zero-length message entities.
*
* readEntity throws Processing Exception
*/
@Test
@Tag("xml_binding")
public void clientCharProviderTest() throws Fault {
setProperty(Property.REQUEST, buildRequest(Request.GET, "entity"));
invoke();
Response response = getResponse();
response.getHeaders().add(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN_TYPE);
try {
Character entity = getResponseBody(Character.class);
fault("No expcetion thrown and entity is", entity);
} catch (Exception e) {
ProcessingException p = assertCause(e, ProcessingException.class, "Processing exception has not been thrown", e);
NoContentException nce = assertCause(e, NoContentException.class, "NoContentException has not been thrown", p);
logMsg("Found expected NoContentException", nce);
}
}
Aggregations