Skip to content

Commit 7b69170

Browse files
committed
Analysis: Resolve non exhaustive when statements test when warning
Warning Message: "Non exhaustive 'when' statements on enum will be prohibited in 1.7, add 'Xyz', 'Xyz' branch(es) or 'else' branch instead" Also, as part of this commit, one other minor warning got resolved too.
1 parent 82209f5 commit 7b69170

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

WordPress/src/test/java/org/wordpress/android/ui/mediapicker/MediaPickerViewModelTest.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class MediaPickerViewModelTest : BaseUnitTest() {
286286
viewModel.refreshData(false)
287287

288288
assertThat(navigateEvents).isEmpty()
289-
clickItem(0)
289+
clickItem()
290290
assertThat(navigateEvents).isNotEmpty
291291
verify(mediaPickerTracker).trackPreview(
292292
firstItem.type == VIDEO,
@@ -724,11 +724,12 @@ class MediaPickerViewModelTest : BaseUnitTest() {
724724
is PhotoItem -> item.toggleAction.toggle()
725725
is VideoItem -> item.toggleAction.toggle()
726726
is FileItem -> item.toggleAction.toggle()
727+
is NextPageLoader -> Unit // Do nothing
727728
}
728729
}
729730

730-
private fun clickItem(position: Int) {
731-
when (val item = itemOnPosition(position)) {
731+
private fun clickItem() {
732+
when (val item = itemOnPosition(0)) {
732733
is PhotoItem -> item.clickAction.click()
733734
is VideoItem -> item.clickAction.click()
734735
is FileItem -> item.clickAction.click()

0 commit comments

Comments
 (0)