Last active
November 11, 2020 01:45
-
-
Save phellipealexandre/08d8f226ce75179311e5858b21fa096a to your computer and use it in GitHub Desktop.
Configuração de um Stub utilizando api do MockK.
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 `Retrieve notes count from server when requested`() { | |
val notesApiStub = mockk<NotesApi>() //Dublê de teste Stub | |
val noteRepository = NoteRepository(notesApiStub) | |
val note = generateDummyNote() //Método privado | |
every { notesApiStub.fetchAllNotes() } returns listOf(note, note) | |
val allNotesCount = noteRepository.getNoteCount() | |
assertEquals(expected = 2, actual = allNotesCount) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment