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

EasyMVP and Robolectric annotations problem #45

Open
bardss opened this issue Jan 14, 2018 · 0 comments
Open

EasyMVP and Robolectric annotations problem #45

bardss opened this issue Jan 14, 2018 · 0 comments

Comments

@bardss
Copy link

bardss commented Jan 14, 2018

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?

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