Skip to content

Instantly share code, notes, and snippets.

@phellipealexandre
Last active May 18, 2022 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phellipealexandre/a458d52d2c58e15aa0c40338cffa1488 to your computer and use it in GitHub Desktop.
Save phellipealexandre/a458d52d2c58e15aa0c40338cffa1488 to your computer and use it in GitHub Desktop.
@Test
fun `Retrieve all notes when requested`() {
val noteApiFake = FakeNoteApi() //Fake double implementing the same interface as the original
val noteRepository = NoteRepository(noteApiFake) //System under test
val note = //Dummy
noteApiFake.uploadNote(note) //Configuring the fake
noteApiFake.uploadNote(note) //Configuring the fake
//Fake with real and lightweight implementation is going to be used under the hoods
val allNotes = noteRepository.getNotes()
assertEquals(expected = 2, actual = allNotes.size)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment