Last active
February 21, 2022 12:13
-
-
Save Farhandroid/318c4e509f73dc0fbaf2cbc63a7a8c48 to your computer and use it in GitHub Desktop.
FirstUnitTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun getSearchedResult_sentRequest_receivedExpected() { | |
runBlocking { | |
// Prepare fake response | |
enqueueMockResponse("ImageResponse.json") | |
//Send Request to the MockServer | |
val responseBody = service.getSearchedImage("nature", 5).body() | |
//Request received by the mock server | |
val request = server.takeRequest() | |
assertThat(responseBody).isNotNull() | |
assertThat(request.path).isEqualTo("/v1/search?query=nature&per_page=5") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment