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/990f90db9c709409ffd2ddaddb73386a to your computer and use it in GitHub Desktop.
Save phellipealexandre/990f90db9c709409ffd2ddaddb73386a to your computer and use it in GitHub Desktop.
@Test
fun `Retrieve notes count from server when requested`() {
val notesApiStub = //Stub
val note = //Dummy
val noteRepository = NoteRepository(notesApiStub) //System under test
//Stub configuration. Hard-coded value returned will be a list with 2 entries.
//This method is going to be called by noteRepository.getNoteCount()
every { notesApiStub.fetchAllNotes() } returns listOf(note, note)
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