MicroShed / MicroShed/microshed-testing
Error if org.microshed.testing.jaxrs.RESTClient return CompletionStage
- Dominant language
- Java
- Stars
- 68
- Forks
- 25
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 6
Description
**Describe the bug**
A service provides a REST api return `CompletionStage<>`.
Used MST RESTClient to test it, got following error:
`javax.ws.rs.client.ResponseProcessingException: Problem with reading the data, class java.util.concurrent.CompletionStage, ContentType: application/json.`
**To Reproduce**
- git clone https://github.com/OpenLiberty/guide-microprofile-reactive-messaging-acknowledgment.git
- cd guide-microprofile-reactive-messaging-acknowledgement/finish
- update inventory/src/test/java/it/io/openliberty/guides/inventory/InventoryServiceIT.java to enable the `testUpdateSystemProperty()` test by uncomment `@Test`
- mvn -pl models install
- cd inventory
- mvn verify
- output will be
```
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 41.349 s <<< FAILURE! - in it.io.openliberty.guides.inventory.InventoryServiceIT
[ERROR] testGetProperty Time elapsed: 0.937 s <<< ERROR!
javax.ws.rs.client.ResponseProcessingException: Problem with reading the data, class java.util.concurrent.CompletionStage, ContentType: application/json.
at it.io.openliberty.guides.inventory.InventoryServiceIT.testGetProperty(InventoryServiceIT.java:96)
Caused by: javax.json.bind.JsonbException: Internal error: Unexpected char 82 at (line no=1, column no=1, offset=0)
at it.io.openliberty.guides.inventory.InventoryServiceIT.testGetProperty(InventoryServiceIT.java:96)
Caused by: javax.json.stream.JsonParsingException: Unexpected char 82 at (line no=1, column no=1, offset=0)
at it.io.openliberty.guides.inventory.InventoryServiceIT.testGetProperty(InventoryServiceIT.java:96)
```
**Expected behavior**
No error and test can be passed
**System information:**
- OS: Linux, Mac
- Java Version: 8
- MicroShed Testing Version: 0.9
**Additional context**
MicroProfile rest client supports to return CompletionStage
Contributor guide
Research direction
Start by reproducing the failure with InventoryServiceIT.java, enabling testUpdateSystemProperty(), then run the listed Maven commands. Trace how the RESTClient processes a CompletionStage response and add coverage for this return type; done means the integration test passes without ResponseProcessingException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100