Using Assert from Junit5 instead of Junit4
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.flowOf
|
|||||||
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
||||||
import kotlinx.coroutines.test.TestCoroutineScope
|
import kotlinx.coroutines.test.TestCoroutineScope
|
||||||
import kotlinx.coroutines.test.runBlockingTest
|
import kotlinx.coroutines.test.runBlockingTest
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.flowOf
|
|||||||
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
||||||
import kotlinx.coroutines.test.TestCoroutineScope
|
import kotlinx.coroutines.test.TestCoroutineScope
|
||||||
import kotlinx.coroutines.test.runBlockingTest
|
import kotlinx.coroutines.test.runBlockingTest
|
||||||
import org.junit.Assert
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
@@ -57,7 +57,7 @@ class BlogRepositoryTest(
|
|||||||
coEvery { localDataSource.save(any()) } just Runs
|
coEvery { localDataSource.save(any()) } just Runs
|
||||||
|
|
||||||
blogRepository.findAll().collect {
|
blogRepository.findAll().collect {
|
||||||
Assert.assertEquals(it.data, PreviewData.Blog.data)
|
assertEquals(it.data, PreviewData.Blog.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(exactly = 1) { remoteDataSource.findAll() }
|
verify(exactly = 1) { remoteDataSource.findAll() }
|
||||||
|
|||||||
+4
-4
@@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.flowOf
|
|||||||
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
||||||
import kotlinx.coroutines.test.TestCoroutineScope
|
import kotlinx.coroutines.test.TestCoroutineScope
|
||||||
import kotlinx.coroutines.test.runBlockingTest
|
import kotlinx.coroutines.test.runBlockingTest
|
||||||
import org.junit.Assert
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
@@ -57,7 +57,7 @@ class LottieFileRepositoryTest(
|
|||||||
coEvery { localDataSource.save(any()) } just Runs
|
coEvery { localDataSource.save(any()) } just Runs
|
||||||
|
|
||||||
repository.findFeatured().collect {
|
repository.findFeatured().collect {
|
||||||
Assert.assertEquals(it.data, PreviewData.Lottiefile.data)
|
assertEquals(it.data, PreviewData.Lottiefile.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(exactly = 1) { remoteDataSource.findFeatured() }
|
verify(exactly = 1) { remoteDataSource.findFeatured() }
|
||||||
@@ -73,7 +73,7 @@ class LottieFileRepositoryTest(
|
|||||||
coEvery { localDataSource.save(any()) } just Runs
|
coEvery { localDataSource.save(any()) } just Runs
|
||||||
|
|
||||||
repository.findRecent().collect {
|
repository.findRecent().collect {
|
||||||
Assert.assertEquals(it.data, PreviewData.Lottiefile.data)
|
assertEquals(it.data, PreviewData.Lottiefile.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(exactly = 1) { remoteDataSource.findRecent() }
|
verify(exactly = 1) { remoteDataSource.findRecent() }
|
||||||
@@ -89,7 +89,7 @@ class LottieFileRepositoryTest(
|
|||||||
coEvery { localDataSource.save(any()) } just Runs
|
coEvery { localDataSource.save(any()) } just Runs
|
||||||
|
|
||||||
repository.findPopular().collect {
|
repository.findPopular().collect {
|
||||||
Assert.assertEquals(it.data, PreviewData.Lottiefile.data)
|
assertEquals(it.data, PreviewData.Lottiefile.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(exactly = 1) { remoteDataSource.findPopular() }
|
verify(exactly = 1) { remoteDataSource.findPopular() }
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.flowOf
|
|||||||
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
||||||
import kotlinx.coroutines.test.TestCoroutineScope
|
import kotlinx.coroutines.test.TestCoroutineScope
|
||||||
import kotlinx.coroutines.test.runBlockingTest
|
import kotlinx.coroutines.test.runBlockingTest
|
||||||
import org.junit.Assert
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
@@ -47,7 +47,7 @@ class UserRepositoryTest(
|
|||||||
every { localDataSource.findAll() } returns flowOf(Result.Success(PreviewData.User.data))
|
every { localDataSource.findAll() } returns flowOf(Result.Success(PreviewData.User.data))
|
||||||
|
|
||||||
repository.findAll().collect {
|
repository.findAll().collect {
|
||||||
Assert.assertEquals(it.data, PreviewData.User.data)
|
assertEquals(it.data, PreviewData.User.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(exactly = 1) { localDataSource.findAll() }
|
verify(exactly = 1) { localDataSource.findAll() }
|
||||||
|
|||||||
Reference in New Issue
Block a user