mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
FilePickerTest: fix failing unit test (#5237)
This commit is contained in:
parent
4cb3b0cfe9
commit
4a9101c614
1 changed files with 2 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ import org.robolectric.RobolectricTestRunner
|
||||||
import org.robolectric.annotation.Config
|
import org.robolectric.annotation.Config
|
||||||
import org.robolectric.annotation.LooperMode
|
import org.robolectric.annotation.LooperMode
|
||||||
import java.lang.reflect.Method
|
import java.lang.reflect.Method
|
||||||
|
import kotlin.random.Random.Default.nextBoolean
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner::class)
|
@RunWith(RobolectricTestRunner::class)
|
||||||
@Config(
|
@Config(
|
||||||
|
|
@ -60,7 +61,7 @@ class FilePickerTest {
|
||||||
`when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref)
|
`when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref)
|
||||||
`when`(sharedPref.edit()).thenReturn(sharedPreferencesEditor)
|
`when`(sharedPref.edit()).thenReturn(sharedPreferencesEditor)
|
||||||
`when`(sharedPref.edit().putInt("type", 0)).thenReturn(sharedPreferencesEditor)
|
`when`(sharedPref.edit().putInt("type", 0)).thenReturn(sharedPreferencesEditor)
|
||||||
FilePicker.openGallery(activity, 0)
|
FilePicker.openGallery(activity, 0, nextBoolean())
|
||||||
verify(activity).startActivityForResult(
|
verify(activity).startActivityForResult(
|
||||||
ArgumentMatchers.anyObject(),
|
ArgumentMatchers.anyObject(),
|
||||||
requestCodeCaptor?.capture()?.toInt()!!
|
requestCodeCaptor?.capture()?.toInt()!!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue