Last active
October 12, 2017 20:47
-
-
Save jianxiansiqi47/e21e801464335318b6fa76eaf232ff30 to your computer and use it in GitHub Desktop.
DealPresenterTestV3 - TP article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DealPresenterTest { | |
@Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); | |
@Rule public ToothPickRule toothPickRule = new ToothPickRule(this, “DealPresenter”); | |
@Mock DealUtil dealUtil; | |
@Mock DealApiClient dealApiClient; | |
@Mock WishlistManager wishlistManager; | |
@Inject DealPresenter dealPresenterUnderTest; | |
@Before | |
public void setUp() { | |
toothPickRule.inject(this); | |
} | |
... | |
@Test | |
public void onWishlistSelected_when_wishlistEnabled() throws Exception { | |
//GIVEN | |
Deal deal = new Deal(); | |
deal.id = "12345"; | |
dealPresenterUnderTest.deal = deal; | |
when(dealUtil.isWishlistEnabled(deal)).thenReturn(true); | |
//WHEN | |
dealPresenterUnderTest.onWishlistSelected(); | |
//THEN | |
verify(wishlistManager).addDealToWishlist(deal.id); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment