reta commented on a change in pull request #866:
URL: https://github.com/apache/cxf/pull/866#discussion_r740999229



##########
File path: 
rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java
##########
@@ -598,6 +601,42 @@ public void testGetLinksMultipleMultiline() {
         }
     }
 
+    @Test
+    public void testReadEntityAndGetEntityAfter() {
+        final String str = "ouch";
+
+        final ResponseImpl response = new ResponseImpl(500, str);
+        final Message outMessage = createMessage();
+        outMessage.put(Message.REQUEST_URI, "http://localhost";);
+        response.setOutMessage(outMessage);
+
+        final MultivaluedMap<String, Object> headers = new MetadataMap<>();
+        headers.putSingle("Content-Type", "text/xml");
+        response.addMetadata(headers);
+
+        assertEquals(str, response.readEntity(String.class));
+        assertThrows(IllegalStateException.class, () -> response.getEntity());

Review comment:
       Thanks @andymc12 , so this is exactly the way it works right now, but I 
am actually trying to fix this TCK test (and few others), which verifies this 
exact flow (unless I miss something): 
https://github.com/eclipse-ee4j/jakartaee-tck/blob/8.0.2/src/com/sun/ts/tests/jaxrs/ee/rs/core/response/JAXRSClient.java#L343
   
   ```
   public void getEntityThrowsIllegalStateExceptionWhenConsumedTest()
         throws Fault {
       Response response = invokeGet("entity");
       response.readEntity(String.class);
       try {
         Object entity = response.getEntity();
         fault("No exception has been thrown entity=", entity);
       } catch (IllegalStateException e) {
         logMsg("#getEntity throws IllegalStateException as expected", e);
       }
     }
   ``` 
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to