Closed smithaaron closed 2 years ago
Hello @smithaaron,
I will try to dig and place the wiki page back.
Until then, you could use the tests source code to mock the responses using org.apache.http.localserver.LocalServerTestBase
:
this.serverBootstrap.registerHandler(
String.format("/%s/%s", projectId, "items/on_roasts"),
(request, response, context) -> {
response.setEntity(
new InputStreamEntity(
this.getClass().getResourceAsStream("SampleContentItem.json")
)
);
});
Hello @smithaaron,
I went through the history of the wiki, but the page was never created.
I browsed the code and filled the Faking response page. I also suggested an alternative way of faking responses, which is implemented right in the client.
If you spot any problem or issue, feel free to re-open this issue.
Expected result
There's a link in the wiki to 'Faking responses for unit testing`, however there is no corresponding page. Are there any guidelines or examples available for unit testing?
Resources
https://github.com/Kentico/kontent-java-packages/wiki