Fix test compilation by removing obsolete testSetImageToBeUploaded and adding tha testInitializeFragmentWithUploadItem (#6404)

This commit is contained in:
Kota-Jagadeesh 2025-10-11 06:32:53 +05:30
parent 4e70e4f91c
commit 29a8762a1c

View file

@ -162,9 +162,20 @@ class UploadMediaDetailFragmentUnitTest {
@Test @Test
@Throws(Exception::class) @Throws(Exception::class)
fun testSetImageToBeUploaded() { fun testInitializeFragmentWithUploadItem() {
Shadows.shadowOf(Looper.getMainLooper()).idle() Shadows.shadowOf(Looper.getMainLooper()).idle()
fragment.setImageToBeUploaded(null, null, location) Whitebox.setInternalState(fragment, "presenter", presenter)
Whitebox.setInternalState(fragment, "uploadItem", uploadItem)
`when`(uploadItem.mediaUri).thenReturn(mediaUri)
`when`(callback.getIndexInViewFlipper(fragment)).thenReturn(0)
`when`(callback.totalNumberOfSteps).thenReturn(2)
val method: Method =
UploadMediaDetailFragment::class.java.getDeclaredMethod(
"initializeFragment",
)
method.isAccessible = true
method.invoke(fragment)
Mockito.verify(presenter).onImageProcessed(uploadItem, 0)
} }
@Test @Test
@ -456,4 +467,4 @@ class UploadMediaDetailFragmentUnitTest {
val shadowIntent: ShadowIntent = shadowOf(startedIntent) val shadowIntent: ShadowIntent = shadowOf(startedIntent)
Assert.assertEquals(shadowIntent.intentClass, LocationPickerActivity::class.java) Assert.assertEquals(shadowIntent.intentClass, LocationPickerActivity::class.java)
} }
} }