https://kotlinlang.org logo
#mockk
Title
# mockk
a

Anthony f

11/28/2018, 4:24 PM
@oleksiyp Hi, I let you a comment on Github, I think we misunderstand each others. Please come back to me for a tchat, if you think this is easier.
o

oleksiyp

11/28/2018, 4:25 PM
Currently commuting home, dont have PC access. So can just answer general questions
Basically in the code in github I do not see usage of mDataManager
Please double check it
And point file/linenumber if I missed something
a

Anthony f

11/28/2018, 4:29 PM
this is not a direct usage
o

oleksiyp

11/28/2018, 4:29 PM
Oh I see your mail
Ok
a

Anthony f

11/28/2018, 4:29 PM
I use it via floatingActionButton.perform(click())
that trigger a listener in the activity
that perform the mDataManager.request....
class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) setSupportActionBar(toolbar) fab.setOnClickListener { view -> DataManager().requestWebService() } }
o

oleksiyp

11/28/2018, 4:30 PM
But arent you having new instance here?
If you need to declare each new instance a mock you need constrctor mock
Please check docs and I will join later this evening
a

Anthony f

11/28/2018, 4:52 PM
yeak, that works now
I didn t know about mock constructor, but that just make sens when I think about it.
as I said, first time mocking instrument tests.... thank you very much
I will explain this in the github issue for others
o

oleksiyp

11/28/2018, 6:54 PM
Sure thanks
6 Views