Closed emystein closed 2 years ago
Interestingly, it was never the intention to use MockResponse in this way. It's kind of a stand-alone thing for use in more traditional testing and wasn't designed to interact with the MockClient's response builder. However, it's certainly logical to think it would work this way. So I fixed it so it can. 3.13.2 should be available in in the next few hours or so (Maven Central is a mystery about when things show up after publishing)
Note that what you end up getting back is NOT the MockResponse itself, but a copy of it. https://github.com/Kong/unirest-java/blob/main/unirest-mocks/src/test/java/kong/tests/ExpectedResponseTest.java#L153-L196
Excellent, thanks for the clarification and the fix @ryber!
Describe the bug When
MockClient
is used andMockResponse.bad
is expected, an Exception is thrown while serializing the Response.To Reproduce Steps to reproduce the behavior:
Stack trace:
Expected behavior The test shown in the steps to reproduce the issue should pass.
Environmental Data:
A project ready to reproduce the issue can be found at: https://github.com/emystein/unirest-mock-response-serialization-issue