#THE ICONIC ANDRIOD TECH TEST
##REACTIVE REPOSITORY
Goal : Make the unit test green
Class : com.theiconic.android.shop.catalog.domain.repositories.ProductsRepository
Unit Test : com.theiconic.android.shop.catalog.domain.repositories.ProductsRepositorySpec
Overview:
We have an empty ProductsRepository Class. Its responsibility is to abstract the behavior of loading and persisting products for a given category. In this case we want to only deal with loading directly from the service and not cache anything.
It is designed to be reactive, and uses RxJava to help achieve this. Because it is reactive when we call nextPage, we do not have to then make another call to getItems; subscribers to getItems should receive another event with all items loaded so far.
ProductService : ProductService is an interface for our REST endpoint. It takes a number of parameters but the only ones you need to pass to it are page and page_size which are integer values. You wont be hitting the actual endpoint though only the mocked interface in the unit test.
Rules : Do not modify the Unit Test. You should beable to make it pass without changing the test. Because of this you will not need to change the ProductRepository API but can add as many protected / private methods as needed.
Tips : You may want to use BehaviorSubjects in your implementation but try to minimize their usage. Try to minimze state.
Technologies : The Unit test are written in Groovy using Spok; this section is the most helpful
RxJava is used to create flows of data and help our object become reactive.