### Question:
IMDBTransactionDao implements TransactionDao { @Override public int updateTransaction(HttpTransaction httpTransaction) { if (httpTransaction.getId() > 0) return transactionDataStore.updateTransaction(httpTransaction) ? 1 : 0; return 0; } IMDBTransactionDao(TransactionDataStore transactionDataStore, TransactionArchComponentProvider transactionArchComponentProvider, TransactionPredicateProvider transactionPredicateProvider); @Override long insertTransaction(HttpTransaction httpTransaction); @Override int updateTransaction(HttpTransaction httpTransaction); @Override int deleteTransactions(HttpTransaction... httpTransactions); @Override int deleteTransactionsBefore(Date beforeDate); @Override int clearAll(); @Override DataSource.Factory<Integer, HttpTransaction> getAllTransactions(); @Override LiveData<HttpTransaction> getTransactionsWithId(long id); @Override DataSource.Factory<Integer, HttpTransaction> getAllTransactionsWith(String key, SearchType searchType);  }### Answer:
@Test public void whenZeroIndexTransaction_isUpdated_shouldReturnZero() { assertThat(transactionDao.updateTransaction(getHttpTransactionWithIndex(0))).isZero(); }
@Test public void whenPositiveIndexTransaction_isUpdated_updateShouldBeCalledOnData() { HttpTransaction transaction = getHttpTransactionWithIndex(22); transactionDao.updateTransaction(transaction); verify(transactionDataStore).updateTransaction(transaction); }
@Test public void whenNegativeIndexTransaction_isUpdated_shouldReturnZero() { assertThat(transactionDao.updateTransaction(getHttpTransactionWithIndex(-1))).isZero(); }