How to mock for UI testing?
andretortolano opened this issue · comments
I'm really confused on how it should work. I'm studying this architecture and converting it to kotling, it seems even tho I can build successfully I cannot get a Mocked instance of API or Preferences helper, what I mean is that I'm trying to mock objects using mockito at ApplicationTestModule but its not replacing the real object from ApplicationModule, I wonder if there is something missing in the flow,... if RuleChain is properly setup in fact. I see the calls from TestComponentRule but
mTestComponent = DaggerTestComponent.builder() .applicationTestModule(ApplicationTestModule(app)) .build()
this is not working
Is it working for Java?
I'm still trying to mock in your sample, for java my problem is that I cannot mock AppApiHelper. but since I'm receiving Mockito error inside the test provider, I imagine that at least the injection is working properly, I'm trying to see if I can get to the same error using kotlin still..
I'll close the issue since I'm trying a solution in kotlin and also @amitshekhariitbhu pointed out that this is working in java for him, so maybe there is a problem on my side.