Search in sources :

Example 1 with Backing

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

the class ViewPledgeViewModelTest method testProjectNameTextViewText.

@Test
public void testProjectNameTextViewText() {
    final Backing backing = BackingFactory.backing();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<String> projectNameTextViewTextTest = TestSubscriber.create();
    vm.outputs.projectNameTextViewText().subscribe(projectNameTextViewTextTest);
    vm.intent(intent(backing));
    projectNameTextViewTextTest.assertValues(backing.project().name());
}
Also used : Backing(com.kickstarter.models.Backing) Test(org.junit.Test)

Example 2 with Backing

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

the class ViewPledgeViewModelTest method testLoadProjectPhoto.

@Test
public void testLoadProjectPhoto() {
    final Backing backing = BackingFactory.backing();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<String> loadProjectPhotoTest = TestSubscriber.create();
    vm.outputs.loadProjectPhoto().subscribe(loadProjectPhotoTest);
    vm.intent(intent(backing));
    loadProjectPhotoTest.assertValues(backing.project().photo().full());
}
Also used : Backing(com.kickstarter.models.Backing) Test(org.junit.Test)

Example 3 with Backing

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

the class ViewPledgeViewModelTest method testRewardsItemAreHidden.

@Test
public void testRewardsItemAreHidden() {
    final Reward reward = RewardFactory.reward().toBuilder().rewardsItems(null).build();
    final Backing backing = BackingFactory.backing().toBuilder().reward(reward).build();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<List<RewardsItem>> rewardsItemsTest = TestSubscriber.create();
    vm.outputs.rewardsItems().subscribe(rewardsItemsTest);
    final TestSubscriber<Boolean> rewardsItemsAreHiddenTest = TestSubscriber.create();
    vm.outputs.rewardsItemsAreHidden().subscribe(rewardsItemsAreHiddenTest);
    vm.intent(intent(backing));
    rewardsItemsTest.assertValues(emptyList());
    rewardsItemsAreHiddenTest.assertValues(true);
}
Also used : Collections.emptyList(java.util.Collections.emptyList) List(java.util.List) Reward(com.kickstarter.models.Reward) Backing(com.kickstarter.models.Backing) Test(org.junit.Test)

Example 4 with Backing

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

the class ViewPledgeViewModelTest method testCreatorNameTextViewText.

@Test
public void testCreatorNameTextViewText() {
    final Backing backing = BackingFactory.backing();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<String> creatorNameTextViewTextTest = TestSubscriber.create();
    vm.outputs.creatorNameTextViewText().subscribe(creatorNameTextViewTextTest);
    vm.intent(intent(backing));
    creatorNameTextViewTextTest.assertValues(backing.project().creator().name());
}
Also used : Backing(com.kickstarter.models.Backing) Test(org.junit.Test)

Example 5 with Backing

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

the class ViewPledgeViewModelTest method testRewardsItemAreEmitted.

@Test
public void testRewardsItemAreEmitted() {
    final Reward reward = RewardFactory.itemized();
    final Backing backing = BackingFactory.backing().toBuilder().reward(reward).build();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<List<RewardsItem>> rewardsItemsTest = TestSubscriber.create();
    vm.outputs.rewardsItems().subscribe(rewardsItemsTest);
    final TestSubscriber<Boolean> rewardsItemsAreHiddenTest = TestSubscriber.create();
    vm.outputs.rewardsItemsAreHidden().subscribe(rewardsItemsAreHiddenTest);
    vm.intent(intent(backing));
    rewardsItemsTest.assertValues(reward.rewardsItems());
    rewardsItemsAreHiddenTest.assertValues(false);
}
Also used : Collections.emptyList(java.util.Collections.emptyList) List(java.util.List) Reward(com.kickstarter.models.Reward) Backing(com.kickstarter.models.Backing) Test(org.junit.Test)

Aggregations

Backing (com.kickstarter.models.Backing)30 Test (org.junit.Test)26 MockCurrentUser (com.kickstarter.libs.MockCurrentUser)11 Project (com.kickstarter.models.Project)11 NonNull (androidx.annotation.NonNull)9 MockApiClient (com.kickstarter.mock.services.MockApiClient)9 MessageThreadEnvelope (com.kickstarter.services.apiresponses.MessageThreadEnvelope)8 Reward (com.kickstarter.models.Reward)7 User (com.kickstarter.models.User)6 BackingWrapper (com.kickstarter.models.BackingWrapper)4 MessageThread (com.kickstarter.models.MessageThread)4 NonNull (android.support.annotation.NonNull)3 Pair (android.util.Pair)2 Collections.emptyList (java.util.Collections.emptyList)2 List (java.util.List)2 Location (com.kickstarter.models.Location)1