From 696561599e68ac2609d862c06b0436fc1a546d6a Mon Sep 17 00:00:00 2001 From: Christian Sadilek Date: Wed, 28 Jul 2021 13:19:20 -0400 Subject: [PATCH] [fenix] Fix intermittent test failures in PagedHistoryProviderTest --- .../components/history/PagedHistoryProviderTest.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/test/java/org/mozilla/fenix/components/history/PagedHistoryProviderTest.kt b/app/src/test/java/org/mozilla/fenix/components/history/PagedHistoryProviderTest.kt index fe58e9a56a..af02f54b94 100644 --- a/app/src/test/java/org/mozilla/fenix/components/history/PagedHistoryProviderTest.kt +++ b/app/src/test/java/org/mozilla/fenix/components/history/PagedHistoryProviderTest.kt @@ -7,10 +7,10 @@ package org.mozilla.fenix.components.history import io.mockk.coEvery import io.mockk.coVerify import io.mockk.mockk -import io.mockk.verify import mozilla.components.concept.storage.HistoryStorage import mozilla.components.concept.storage.VisitInfo import mozilla.components.concept.storage.VisitType +import org.junit.Assert.assertSame import org.junit.Before import org.junit.Test @@ -27,11 +27,12 @@ class PagedHistoryProviderTest { fun `getHistory uses getVisitsPaginated`() { val provider = storage.createSynchronousPagedHistoryProvider() val results = listOf(mockk(), mockk()) - val onComplete = mockk<(List) -> Unit>(relaxed = true) - coEvery { storage.getVisitsPaginated(any(), any(), any()) } returns results - provider.getHistory(10L, 5, onComplete) + var actualResults: List? = null + provider.getHistory(10L, 5) { + actualResults = it + } coVerify { storage.getVisitsPaginated( @@ -48,6 +49,7 @@ class PagedHistoryProviderTest { ) ) } - verify { onComplete(results) } + + assertSame(results, actualResults) } }