Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compiling test class with a fragment that not inherits directly but indirectly from Fragment class #503

Open
albertB4work opened this issue Jan 16, 2024 · 0 comments

Comments

@albertB4work
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant