Kong / unirest-java

Unirest in Java: Simplified, lightweight HTTP client library.
http://kong.github.io/unirest-java/
MIT License
2.58k stars 591 forks source link

Mocking Unirest in Junit5 #482

Closed vamsi-6579 closed 11 months ago

vamsi-6579 commented 11 months ago

A clear and concise description of what the problem is, I'm always frustrated when I'm trying to mock the Unirest call in Junit5 Provide features to mock the Unirest by updating the dependency or by adding a new dependency

ryber commented 11 months ago

There is a mocking module that has existed for the last 3 years: https://github.com/Kong/unirest-java/tree/main/unirest-mocks

ryber commented 11 months ago

Check out the tests for more examples: https://github.com/Kong/unirest-java/blob/main/unirest-mocks/src/test/java/kong/tests

vamsi-6579 commented 11 months ago

we are using mashape import which is old, But after changing to this import

com.konghq unirest-java-core 4.0.3 provided

Iam unable to import MockClient

ryber commented 11 months ago

you need to pull in the mocking module, its its own dependency