Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use Truth in tests
  • Loading branch information
simonschiller committed Oct 29, 2020
commit 5950e786285bbc2bb4359893585452f40a798d8d
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ import androidx.test.core.app.ApplicationProvider
import androidx.test.filters.SmallTest
import androidx.testutils.TestNavigator
import androidx.testutils.test
import kotlinx.coroutines.ExperimentalCoroutinesApi
import com.google.common.truth.Truth.assertWithMessage
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.withIndex
import kotlinx.coroutines.runBlocking
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test

Expand Down Expand Up @@ -63,7 +62,9 @@ class NavControllerTest {
.withIndex()
.onEach { (index, backStackEntry) ->
val expectedDestination = index + 1
assertEquals(expectedDestination, backStackEntry.destination.id)
assertWithMessage("Flow emitted unexpected back stack entry (wrong destination)")
.that(backStackEntry.destination.id)
.isEqualTo(expectedDestination)

if (expectedDestination < navController.graph.count()) {
navController.navigate(expectedDestination + 1)
Expand Down