コード例 #1
0
  @Test
  public void testGetExpenses_obtainingEmptyExpensesList() {

    List<ExpenseModel> emptyExpenseModelList = new ArrayList<>();

    when(mExpenseDao.getExpenses()).thenReturn(emptyExpenseModelList);

    mExpensesInboxPresenter.getExpenses();

    verify(mExpenseDao).getExpenses();
    verify(mExpensesInboxActivity).listExpenses(emptyExpenseModelList);
  }
コード例 #2
0
  @Test
  public void testGetExpenses_successfulObtainingExpensesList() {

    List<ExpenseModel> expenseModelList = getExpensesList();

    when(mExpenseDao.getExpenses()).thenReturn(expenseModelList);

    mExpensesInboxPresenter.getExpenses();

    verify(mExpenseDao).getExpenses();
    verify(mExpensesInboxActivity).listExpenses(expenseModelList);
  }