@Test public void getAllTransactionsWithRequest_shouldCallArchComponentProviderWithRequestedSearchTermAndRequestSearchPredicate() { when(transactionPredicateProvider.getRequestSearchPredicate("test")).thenReturn(testPredicate); transactionDao.getAllTransactionsWith("test", TransactionDao.SearchType.INCLUDE_REQUEST); verify(transactionPredicateProvider).getRequestSearchPredicate("test"); verify(transactionArchComponentProvider).getDataSourceFactory(eq(transactionDataStore), eq(testPredicate)); }
@Override public DataSource.Factory<Integer, HttpTransaction> getAllTransactionsWith(String key, SearchType searchType) { Predicate<HttpTransaction> predicate; switch (searchType) { case DEFAULT: default: predicate = transactionPredicateProvider.getDefaultSearchPredicate(key); break; case INCLUDE_REQUEST: predicate = transactionPredicateProvider.getRequestSearchPredicate(key); break; case INCLUDE_RESPONSE: predicate = transactionPredicateProvider.getResponseSearchPredicate(key); break; case INCLUDE_REQUEST_RESPONSE: predicate = transactionPredicateProvider.getRequestResponseSearchPredicate(key); break; } return transactionArchComponentProvider.getDataSourceFactory(transactionDataStore, predicate); }
IMDBTransactionDao implements TransactionDao { @Override public DataSource.Factory<Integer, HttpTransaction> getAllTransactionsWith(String key, SearchType searchType) { Predicate<HttpTransaction> predicate; switch (searchType) { case DEFAULT: default: predicate = transactionPredicateProvider.getDefaultSearchPredicate(key); break; case INCLUDE_REQUEST: predicate = transactionPredicateProvider.getRequestSearchPredicate(key); break; case INCLUDE_RESPONSE: predicate = transactionPredicateProvider.getResponseSearchPredicate(key); break; case INCLUDE_REQUEST_RESPONSE: predicate = transactionPredicateProvider.getRequestResponseSearchPredicate(key); break; } return transactionArchComponentProvider.getDataSourceFactory(transactionDataStore, predicate); } }
IMDBTransactionDao implements TransactionDao { @Override public DataSource.Factory<Integer, HttpTransaction> getAllTransactionsWith(String key, SearchType searchType) { Predicate<HttpTransaction> predicate; switch (searchType) { case DEFAULT: default: predicate = transactionPredicateProvider.getDefaultSearchPredicate(key); break; case INCLUDE_REQUEST: predicate = transactionPredicateProvider.getRequestSearchPredicate(key); break; case INCLUDE_RESPONSE: predicate = transactionPredicateProvider.getResponseSearchPredicate(key); break; case INCLUDE_REQUEST_RESPONSE: predicate = transactionPredicateProvider.getRequestResponseSearchPredicate(key); break; } return transactionArchComponentProvider.getDataSourceFactory(transactionDataStore, predicate); } IMDBTransactionDao(TransactionDataStore transactionDataStore, TransactionArchComponentProvider transactionArchComponentProvider, TransactionPredicateProvider transactionPredicateProvider); }
IMDBTransactionDao implements TransactionDao { @Override public DataSource.Factory<Integer, HttpTransaction> getAllTransactionsWith(String key, SearchType searchType) { Predicate<HttpTransaction> predicate; switch (searchType) { case DEFAULT: default: predicate = transactionPredicateProvider.getDefaultSearchPredicate(key); break; case INCLUDE_REQUEST: predicate = transactionPredicateProvider.getRequestSearchPredicate(key); break; case INCLUDE_RESPONSE: predicate = transactionPredicateProvider.getResponseSearchPredicate(key); break; case INCLUDE_REQUEST_RESPONSE: predicate = transactionPredicateProvider.getRequestResponseSearchPredicate(key); break; } return transactionArchComponentProvider.getDataSourceFactory(transactionDataStore, predicate); } 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); }
IMDBTransactionDao implements TransactionDao { @Override public DataSource.Factory<Integer, HttpTransaction> getAllTransactionsWith(String key, SearchType searchType) { Predicate<HttpTransaction> predicate; switch (searchType) { case DEFAULT: default: predicate = transactionPredicateProvider.getDefaultSearchPredicate(key); break; case INCLUDE_REQUEST: predicate = transactionPredicateProvider.getRequestSearchPredicate(key); break; case INCLUDE_RESPONSE: predicate = transactionPredicateProvider.getResponseSearchPredicate(key); break; case INCLUDE_REQUEST_RESPONSE: predicate = transactionPredicateProvider.getRequestResponseSearchPredicate(key); break; } return transactionArchComponentProvider.getDataSourceFactory(transactionDataStore, predicate); } 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);  }