Open
Description
I have problem while trying to use Robolectric to test activity which is using EasyMvp. All of the classes are written in Kotlin.
Part of Activity:
@ActivityView(layout = R.layout.activity_access, presenter = AccessPresenterImpl::class)
class AccessActivity : BaseActivity(), AccessView {
@Presenter
lateinit var presenter: AccessPresenter
override fun providePresenter(): BasePresenter? {
return presenter
}
I was trying to introduce Robolectric tests in my app.
var activity: AccessActivity? = null
var loginEditText: EditText? = null
var passwordEditText: EditText? = null
@Before
fun initData() {
activity = Robolectric.setupActivity(AccessActivity::class.java)
loginEditText = activity?.findViewById(R.id.loginEditText)
passwordEditText = activity?.findViewById(R.id.passwordEditText)
}
But while Running the test, I am always getting error:
kotlin.UninitializedPropertyAccessException: lateinit property presenter has not been initialized
I tried numerous of ideas like changing presenter to nullable object, but EasyMVP do not compile with it.
Any solution for that?
Metadata
Metadata
Assignees
Labels
No labels