mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 05:43:55 +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.google.android.material:material:1.12.0"
|
||||||
implementation 'com.karumi:dexter:5.0.0'
|
implementation 'com.karumi:dexter:5.0.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-runtime-compose-android:2.8.7'
|
||||||
|
|
||||||
// Jetpack Compose
|
// Jetpack Compose
|
||||||
def composeBom = platform('androidx.compose:compose-bom:2024.11.00')
|
def composeBom = platform('androidx.compose:compose-bom:2024.11.00')
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ class BookmarkListRootFragmentUnitTest {
|
||||||
@Test
|
@Test
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun testGetMediaAtPositionCaseNull() {
|
fun testGetMediaAtPositionCaseNull() {
|
||||||
whenever(bookmarksPagerAdapter.mediaAdapter).thenReturn(null)
|
whenever(bookmarksPagerAdapter.getMediaAdapter()).thenReturn(null)
|
||||||
Assert.assertEquals(fragment.getMediaAtPosition(0), null)
|
Assert.assertEquals(fragment.getMediaAtPosition(0), null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,7 +226,7 @@ class BookmarkListRootFragmentUnitTest {
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun testGetMediaAtPositionCaseNonNull() {
|
fun testGetMediaAtPositionCaseNonNull() {
|
||||||
val listAdapter = mock(ListAdapter::class.java)
|
val listAdapter = mock(ListAdapter::class.java)
|
||||||
whenever(bookmarksPagerAdapter.mediaAdapter).thenReturn(listAdapter)
|
whenever(bookmarksPagerAdapter.getMediaAdapter()).thenReturn(listAdapter)
|
||||||
whenever(listAdapter.getItem(0)).thenReturn(media)
|
whenever(listAdapter.getItem(0)).thenReturn(media)
|
||||||
Assert.assertEquals(fragment.getMediaAtPosition(0), media)
|
Assert.assertEquals(fragment.getMediaAtPosition(0), media)
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +234,7 @@ class BookmarkListRootFragmentUnitTest {
|
||||||
@Test
|
@Test
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun testGetTotalMediaCountCaseNull() {
|
fun testGetTotalMediaCountCaseNull() {
|
||||||
whenever(bookmarksPagerAdapter.mediaAdapter).thenReturn(null)
|
whenever(bookmarksPagerAdapter.getMediaAdapter()).thenReturn(null)
|
||||||
Assert.assertEquals(fragment.totalMediaCount, 0)
|
Assert.assertEquals(fragment.totalMediaCount, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,7 +242,7 @@ class BookmarkListRootFragmentUnitTest {
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun testGetTotalMediaCountCaseNonNull() {
|
fun testGetTotalMediaCountCaseNonNull() {
|
||||||
val listAdapter = mock(ListAdapter::class.java)
|
val listAdapter = mock(ListAdapter::class.java)
|
||||||
whenever(bookmarksPagerAdapter.mediaAdapter).thenReturn(listAdapter)
|
whenever(bookmarksPagerAdapter.getMediaAdapter()).thenReturn(listAdapter)
|
||||||
whenever(listAdapter.count).thenReturn(1)
|
whenever(listAdapter.count).thenReturn(1)
|
||||||
Assert.assertEquals(fragment.totalMediaCount, 1)
|
Assert.assertEquals(fragment.totalMediaCount, 1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class BookmarkItemsControllerTest {
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
MockitoAnnotations.openMocks(this)
|
MockitoAnnotations.openMocks(this)
|
||||||
whenever(bookmarkDao!!.allBookmarksItems)
|
whenever(bookmarkDao!!.getAllBookmarksItems())
|
||||||
.thenReturn(mockBookmarkList)
|
.thenReturn(mockBookmarkList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue