From 7726fa99121067c5d821e669e15c3dc80e322c12 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Wed, 11 Oct 2023 22:30:17 +0700 Subject: [PATCH] Assert returned result --- .../navigator/data/utils/DevicePathsExtractorTest.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/test/java/dev/arkbuilders/navigator/data/utils/DevicePathsExtractorTest.kt b/app/src/test/java/dev/arkbuilders/navigator/data/utils/DevicePathsExtractorTest.kt index 7d908a86..e336808b 100644 --- a/app/src/test/java/dev/arkbuilders/navigator/data/utils/DevicePathsExtractorTest.kt +++ b/app/src/test/java/dev/arkbuilders/navigator/data/utils/DevicePathsExtractorTest.kt @@ -4,6 +4,7 @@ import dev.arkbuilders.navigator.presentation.App import io.mockk.every import io.mockk.mockk import io.mockk.verify +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.runner.RunWith @@ -11,6 +12,7 @@ import org.mockito.junit.MockitoJUnitRunner import java.io.File import java.nio.file.Path import java.nio.file.Paths +import kotlin.io.path.name @RunWith(MockitoJUnitRunner::class) class DevicePathsExtractorTest { @@ -39,12 +41,14 @@ class DevicePathsExtractorTest { val directoryIterator: MutableIterator = arrayListOf( Paths.get("PATH") - ).iterator() every { mockedPath.iterator() } returns directoryIterator - testee.listDevices() + val result = testee.listDevices() verify { mockedApplication.getExternalFilesDirs(null) } + assertEquals(1, result.size) + assertEquals("PATH", result[0].name) } + }