Created
November 11, 2020 01:39
-
-
Save phellipealexandre/c79d7f99e1277f7089d00abd2ed8679a to your computer and use it in GitHub Desktop.
Exemplo onde substituimos a dependencia de AnalyticsWrapper por um Spy que irá "gravar" as chamadas. A assertiva estará implementada dentro do Spy.
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 `Track analytics event when creating new note`() { | |
val analyticsWrapperSpy = //Dublê de teste Spy | |
val noteAnalytics = NoteAnalytics(analyticsWrapperSpy) | |
//Spy grava o comportamento por debaixo dos panos | |
noteAnalytics.trackCreateNewNoteEvent(NoteType.Supermarket) | |
//Spy verifica que comportamento ocorreu baseado em implementação interna | |
analyticsWrapperSpy.assertThatNewNoteEventWasRegistered("SuperMarket") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment