Last active
October 3, 2017 00:29
-
-
Save jianxiansiqi47/026ad9aa16637be1601e12827338a0e9 to your computer and use it in GitHub Desktop.
DealPresenterTestV1 - 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 { | |
private DealUtil dealUtil; | |
private DealApiClient dealApiClient; | |
private WishlistManager wishlistManager; | |
private DealViewStateModel dealViewStateModel = new DealViewStateModel(); | |
private DealPresenter dealPresenterUnderTest; | |
@Before | |
public void setUp() { | |
dealUtil = mock(DealUtil.class); | |
dealApiClient = mock(DealApiClient.class); | |
wishlistManager = mock(WishlistManager.class); | |
dealPresenterUnderTest = new DealPresenter(dealUtil, dealApiClient, wishlistManager, dealViewStateModel); | |
... | |
} | |
... | |
@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