Search in sources :

Example 66 with MockApiClient

use of com.kickstarter.mock.services.MockApiClient in project android-oss by kickstarter.

the class ProjectUpdatesViewModelTest method testProjectAndUpdates.

@Test
public void testProjectAndUpdates() {
    final List<Update> updates = Arrays.asList(UpdateFactory.update(), UpdateFactory.update());
    final Project project = ProjectFactory.project();
    setUpEnvironment(environment().toBuilder().apiClient(new MockApiClient() {

        @NonNull
        @Override
        public Observable<UpdatesEnvelope> fetchUpdates(@NonNull final Project project) {
            return Observable.just(UpdatesEnvelope.builder().updates(updates).urls(urlsEnvelope()).build());
        }
    }).build(), project, ProjectDataFactory.Companion.project(project));
    this.projectAndUpdates.assertValues(Pair.create(project, updates));
}
Also used : Project(com.kickstarter.models.Project) MockApiClient(com.kickstarter.mock.services.MockApiClient) NonNull(androidx.annotation.NonNull) Update(com.kickstarter.models.Update) Observable(rx.Observable) Test(org.junit.Test)

Aggregations

MockApiClient (com.kickstarter.mock.services.MockApiClient)66 Test (org.junit.Test)64 NonNull (androidx.annotation.NonNull)47 MockCurrentUser (com.kickstarter.libs.MockCurrentUser)33 Environment (com.kickstarter.libs.Environment)29 Intent (android.content.Intent)28 Project (com.kickstarter.models.Project)25 ApiClientType (com.kickstarter.services.ApiClientType)19 User (com.kickstarter.models.User)14 CurrentUserType (com.kickstarter.libs.CurrentUserType)12 DiscoveryParams (com.kickstarter.services.DiscoveryParams)12 MessageThreadEnvelope (com.kickstarter.services.apiresponses.MessageThreadEnvelope)12 Backing (com.kickstarter.models.Backing)9 MessageThread (com.kickstarter.models.MessageThread)9 TestScheduler (rx.schedulers.TestScheduler)8 TestSubscriber (rx.observers.TestSubscriber)7 Update (com.kickstarter.models.Update)6 AccessTokenEnvelope (com.kickstarter.services.apiresponses.AccessTokenEnvelope)6 DiscoverEnvelope (com.kickstarter.services.apiresponses.DiscoverEnvelope)6 ProjectsEnvelope (com.kickstarter.services.apiresponses.ProjectsEnvelope)6