mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 13:23:58 +01:00
Unit tests solved
This commit is contained in:
parent
16eb639b31
commit
78676b2281
3 changed files with 6 additions and 5 deletions
|
|
@ -50,6 +50,7 @@ dependencies {
|
|||
implementation "com.google.android.material:material:1.12.0"
|
||||
implementation 'com.karumi:dexter:5.0.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-compose-android:2.8.7'
|
||||
|
||||
// Jetpack Compose
|
||||
def composeBom = platform('androidx.compose:compose-bom:2024.11.00')
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ class BookmarkListRootFragmentUnitTest {
|
|||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun testGetMediaAtPositionCaseNull() {
|
||||
whenever(bookmarksPagerAdapter.mediaAdapter).thenReturn(null)
|
||||
whenever(bookmarksPagerAdapter.getMediaAdapter()).thenReturn(null)
|
||||
Assert.assertEquals(fragment.getMediaAtPosition(0), null)
|
||||
}
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ class BookmarkListRootFragmentUnitTest {
|
|||
@Throws(Exception::class)
|
||||
fun testGetMediaAtPositionCaseNonNull() {
|
||||
val listAdapter = mock(ListAdapter::class.java)
|
||||
whenever(bookmarksPagerAdapter.mediaAdapter).thenReturn(listAdapter)
|
||||
whenever(bookmarksPagerAdapter.getMediaAdapter()).thenReturn(listAdapter)
|
||||
whenever(listAdapter.getItem(0)).thenReturn(media)
|
||||
Assert.assertEquals(fragment.getMediaAtPosition(0), media)
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ class BookmarkListRootFragmentUnitTest {
|
|||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun testGetTotalMediaCountCaseNull() {
|
||||
whenever(bookmarksPagerAdapter.mediaAdapter).thenReturn(null)
|
||||
whenever(bookmarksPagerAdapter.getMediaAdapter()).thenReturn(null)
|
||||
Assert.assertEquals(fragment.totalMediaCount, 0)
|
||||
}
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ class BookmarkListRootFragmentUnitTest {
|
|||
@Throws(Exception::class)
|
||||
fun testGetTotalMediaCountCaseNonNull() {
|
||||
val listAdapter = mock(ListAdapter::class.java)
|
||||
whenever(bookmarksPagerAdapter.mediaAdapter).thenReturn(listAdapter)
|
||||
whenever(bookmarksPagerAdapter.getMediaAdapter()).thenReturn(listAdapter)
|
||||
whenever(listAdapter.count).thenReturn(1)
|
||||
Assert.assertEquals(fragment.totalMediaCount, 1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class BookmarkItemsControllerTest {
|
|||
@Before
|
||||
fun setup() {
|
||||
MockitoAnnotations.openMocks(this)
|
||||
whenever(bookmarkDao!!.allBookmarksItems)
|
||||
whenever(bookmarkDao!!.getAllBookmarksItems())
|
||||
.thenReturn(mockBookmarkList)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue