testing-samples
testing-samples copied to clipboard
Not compiling test class with a fragment that not inherits directly but indirectly from Fragment class
I'm working with this code:
@RunWith(AndroidJUnit4ClassRunner::class)
class FiltersFragmentTest {
@Test
fun fragmentIsVisible() {
val scenario = launchFragmentInContainer<FiltersFragment>()
scenario.recreate()
Espresso
.onView(ViewMatchers.withId(R.id.jvQuery))
.check(matches(isDisplayed()))
}
}
The FiltersFragment class inherits from a class custom, that inherits from another custom base fragment class that inherits from Fragment (androidx.fragment.app.Fragment). But when trying to execute the test an error is shown in compile time
Cannot access class 'androidx.fragment.app.FragmentFactory'. Check your module classpath for missing or conflicting dependencies Type argument is not within its bounds: should be subtype of 'Fragment'
I see in my project dependencies two versions of fragment library: 1.3.6 for appCompat library use and direct dependency 1.6.2 Both have FragmentFactory class inside