@Test public void onCreateTest() { List<ShopData> shopList = new ArrayList<ShopData>(); when(useCaseMock.getFavoriteList()).thenReturn(shopList); FavoriteListPresenter presenter = new FavoriteListPresenter(useCaseMock); presenter.onCreate(viewMock); verify(viewMock, times(1)).initViews(); verify(useCaseMock, times(1)).getFavoriteList(); verify(viewMock, times(1)).addShopList(shopList); }
@Test public void onListItemClickTest() { FavoriteListPresenter presenter = new FavoriteListPresenter(useCaseMock); presenter.onCreate(viewMock); ShopData shopData = new ShopData(gourmetRoot.results.shop.get(0)); ImageView imageView = new ImageView(InstrumentationRegistry.getContext()); presenter.onListItemClick(shopData, imageView); verify(viewMock, times(1)).startShopDetailsActivity(shopData, null); Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ALPHA_8); imageView.setImageBitmap(bitmap); presenter.onListItemClick(shopData, imageView); verify(viewMock, times(1)).startShopDetailsActivity(shopData, null); verify(viewMock, times(1)).startShopDetailsActivity(shopData, bitmap); }