Created
August 23, 2022 15:18
-
-
Save aqua30/e10a8aab699a49fe1e378bbc7c6c70c8 to your computer and use it in GitHub Desktop.
This file contains 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 `for multiple users, api must return all users with http code 200`() = runTest { | |
val users = listOf( | |
User(1,"Saurabh","Delhi","India"), | |
User(2,"Zergain","London","UK"), | |
) | |
val expectedResponse = MockResponse() | |
.setResponseCode(HttpURLConnection.HTTP_OK) | |
.setBody(Gson().toJson(users)) | |
mockWebServer.enqueue(expectedResponse) | |
val actualResponse = repository.getAllUsers() | |
assertThat(actualResponse.body).hasSize(2) | |
assertThat(actualResponse.body).isEqualTo(users) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment