Last active
May 18, 2022 17:53
-
-
Save phellipealexandre/9f38486fc8a3026c8382100f4816f9b6 to your computer and use it in GitHub Desktop.
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
interface NoteApi { | |
suspend fun uploadNote(note: Note): Result | |
suspend fun fetchAllNotes(): List<Note> | |
} | |
class RealNoteApi : NoteApi { | |
override suspend fun uploadNote(note: Note): Result { | |
//Real implementation | |
} | |
override suspend fun fetchAllNotes(): List<Note> { | |
//Real implementation | |
} | |
} | |
class StubNoteApi( | |
val notes: List<Note> = listOf(), | |
val result: Result = Result.Success | |
) : NoteApi { | |
override suspend fun uploadNote(note: Note): Result { | |
return result | |
} | |
override suspend fun fetchAllNotes(): List<Note> { | |
return notes | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment