Skip to content

Commit 0a36e03

Browse files
Akshaykomar890angrezichatterbox
authored andcommitted
fix: Update processSuggestions test to use mocked SuggestionHandler
(cherry picked from commit f0dc571)
1 parent c1807d7 commit 0a36e03

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

app/src/androidTest/kotlin/be/scri/helpers/KeyboardTest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,18 @@ class KeyboardTest {
7676

7777
@Test
7878
fun processSuggestions() {
79-
every { mockIME.suggestionHandler.findGenderForLastWord(any(), "in") } returns listOf("Neuter")
80-
every { mockIME.suggestionHandler.findWhetherWordIsPlural(any(), "in") } returns false
81-
every { mockIME.suggestionHandler.getCaseAnnotationForPreposition(any(), "in") } returns null
82-
83-
every { mockIME.updateAutoSuggestText(any(), any(), any(), any()) } answers {
79+
val mockSuggestionHandler = mockk<SuggestionHandler>(relaxed = true)
80+
every { mockIME.suggestionHandler } returns mockSuggestionHandler
81+
every { mockSuggestionHandler.findGenderForLastWord(any(), "in") } returns listOf("Neuter")
82+
every { mockSuggestionHandler.findWhetherWordIsPlural(any(), "in") } returns false
83+
every { mockSuggestionHandler.getCaseAnnotationForPreposition(any(), "in") } returns null
84+
every { mockSuggestionHandler.processLinguisticSuggestions("in") } answers {
8485
conjugateBtn.text = "der"
8586
pluralBtn.text = "den"
8687
translateBtn.text = "die"
8788
}
88-
89-
suggestionHandler.processLinguisticSuggestions("in")
90-
89+
mockSuggestionHandler.processLinguisticSuggestions("in")
90+
verify(exactly = 1) { mockSuggestionHandler.processLinguisticSuggestions("in") }
9191
verify { conjugateBtn.text = match { it.isNotEmpty() } }
9292
verify { pluralBtn.text = match { it.isNotEmpty() } }
9393
verify { translateBtn.text = match { it.isNotEmpty() } }

0 commit comments

Comments
 (0)