Search in sources :

Example 11 with Update

use of com.kickstarter.models.Update in project android-oss by kickstarter.

the class ProjectUpdatesViewModelTest method testProjectUpdatesViewModel_StartCommentsActivity.

@Test
public void testProjectUpdatesViewModel_StartCommentsActivity() {
    final ProjectUpdatesViewModel.ViewModel vm = new ProjectUpdatesViewModel.ViewModel(environment());
    final Project project = ProjectFactory.project();
    final Request commentsRequest = new Request.Builder().url("https://kck.str/projects/param/param/posts/id/comments").build();
    final TestSubscriber<Update> startCommentsActivity = new TestSubscriber<>();
    vm.outputs.startCommentsActivity().subscribe(startCommentsActivity);
    vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
    vm.inputs.goToCommentsRequest(commentsRequest);
    startCommentsActivity.assertValueCount(1);
}
Also used : Project(com.kickstarter.models.Project) Request(okhttp3.Request) TestSubscriber(rx.observers.TestSubscriber) Intent(android.content.Intent) Update(com.kickstarter.models.Update) Test(org.junit.Test)

Example 12 with Update

use of com.kickstarter.models.Update in project android-oss by kickstarter.

the class UpdateViewModelTest method testUpdateViewModel_StartShareIntent.

@Test
public void testUpdateViewModel_StartShareIntent() {
    final UpdateViewModel.ViewModel vm = new UpdateViewModel.ViewModel(environment());
    final Update update = UpdateFactory.update();
    final TestSubscriber<Update> startShareIntent = new TestSubscriber<>();
    vm.outputs.startShareIntent().subscribe(startShareIntent);
    // Start the intent with a project and update.
    vm.intent(new Intent().putExtra(IntentKey.PROJECT, ProjectFactory.project()).putExtra(IntentKey.UPDATE, update));
    vm.inputs.shareIconButtonClicked();
    startShareIntent.assertValues(update);
}
Also used : TestSubscriber(rx.observers.TestSubscriber) Intent(android.content.Intent) Update(com.kickstarter.models.Update) Test(org.junit.Test)

Aggregations

Update (com.kickstarter.models.Update)12 Test (org.junit.Test)8 TestSubscriber (rx.observers.TestSubscriber)8 Intent (android.content.Intent)7 Project (com.kickstarter.models.Project)5 Request (okhttp3.Request)5 NonNull (android.support.annotation.NonNull)4 Environment (com.kickstarter.libs.Environment)3 ApiClientType (com.kickstarter.services.ApiClientType)3 MockApiClient (com.kickstarter.services.MockApiClient)3 Context (android.content.Context)2 Photo (com.kickstarter.models.Photo)2 User (com.kickstarter.models.User)2 Nullable (android.support.annotation.Nullable)1 KSRobolectricTestCase (com.kickstarter.KSRobolectricTestCase)1 ProjectFactory (com.kickstarter.factories.ProjectFactory)1 UpdateFactory (com.kickstarter.factories.UpdateFactory)1 KoalaEvent (com.kickstarter.libs.KoalaEvent)1 NumberUtils (com.kickstarter.libs.utils.NumberUtils)1 Activity (com.kickstarter.models.pushdata.Activity)1