Created
November 11, 2020 01:38
-
-
Save phellipealexandre/545d42d108e6ba71e060ee39e3258fda to your computer and use it in GitHub Desktop.
Exemplo de utilização de um Mock que verifica que um método específico foi chamado.
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 `Track analytics event when creating new note`() { | |
val analyticsWrapperMock = //Dublê de teste Mock | |
val noteAnalytics = NoteAnalytics(analyticsWrapperMock) | |
noteAnalytics.trackNewNoteEvent(NoteType.Supermarket) | |
//Mock verifica que comportamento específico aconteceu | |
verify(exactly = 1) { analyticsWrapperMock.logEvent("NewNote", "SuperMarket") } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment