Error mocking Class which hold reference to SQLiteOpenHelper

前端 未结 3 497
傲寒
傲寒 2021-01-22 23:52

I write unit test for my Presenter, which is need to mock my Local Data Source.

Here is my simple test :

public class AddressPresenterTest {
           


        
3条回答
  •  天涯浪人
    2021-01-23 00:34

    Seems you also need to mock StaticDatabaseHelper. Then Mockito should automatically inject your mocked instance into the AddressLocalDataSource. So adding following line may solves your issue:

    public class AddressPresenterTest {
        @Mock
        StaticDatabaseHelper mockedDatabaseHelper;
        ...
    

提交回复
热议问题