Issue
Using this guide to test dialog https://developer.android.com/guide/fragments/test The bottom sample
with(launchFragment<MyDialogFragment>()) {
onFragment { fragment -> // here error
assertThat(fragment.dialog).isNotNull()
assertThat(fragment.requireDialog().isShowing).isTrue()
fragment.dismiss()
fragment.parentFragmentManager.executePendingTransactions()
assertThat(fragment.dialog).isNull()
}
}
But here it shows error
onFragment { fragment -> // error below
Type mismatch. Required: FragmentScenario.FragmentAction Found: (???) → Unit Cannot infer a type for this parameter. Please specify it explicitly
Solution
Guys the solution was Kotlin version. So update Kotlin plugin in studio solves the issue
Answered By - Bob Redity
Answer Checked By - Marilyn (JavaFixing Volunteer)