I have declared an activity like this
class QuestionnaireActivity<T : ProfileModel> : AppCompatActivity()
I want to write an espresso test so I'm writting ActivityTestRule like
@Rule @JvmField
val activityRule = object : ActivityTestRule<QuestionnaireActivity<ProfileModel.PersonalInfo>>(QuestionnaireActivity<ProfileModel.LifeStyleInfo>::class.java){
override fun getActivityIntent(): Intent = QuestionnaireActivity.getQuestionnaireIntent(InstrumentationRegistry.getTargetContext(), 3, ProfileModel.LifeStyleInfo())
}
but the compiler complains that(its about the argument of ActivityTestRule)
only classes are allowed on the left hand side of a class literal
It is stated here that generics can't be used with class.
If I remove the generic type parameter the error becomes
Type inference failed.
Expected type mismatch: inferred type is Class<QuestionnaireActivity<*>> but Class<QuestionnaireActivity<ProfileModel.PersonalInfo>!>! was expected
what should I do?
thanks for your attention