The Data layer uses a data store factory to abstract the source of the data that our application uses from the repository that we use to access data. In this lesson, we're going to be writing some tests to ensure that the correct factory classes are returned when requested.
Hello Joe, Can we use this?
private lateinit var factory:ProjectsDataStoreFactory
lateinit var cacheStore:ProjectsCacheDataStore
lateinit var remoteStore:ProjectsRemoteDataStore
factory = ProjectsDataStoreFactory(cacheStore,remoteStore)
yes you can do it
but you will get an error
Mockito cannot mock/spy following:
– final classes
to fix it you’ll need to create a file in the test/resources/mockito-extensions folder called org.mockito.plugins.MockMaker
and you have to write this line
reference : https://antonioleiva.com/mockito-2-kotlin/
yes u can. and mockito doesnt work with final classes but mockito 2 does. If you guys are facing any issues with this test and don't know about this fix, goto :https://stackoverflow.com/questions/14292863/how-to-mock-a-final-class-with-mockito
Answers are there. :)