@Test public void reportTransactions() throws Exception { api_cache.report(createTransactionData()); ApiTransaction[] t1 = api_cache.getTransactionFor("bce4c8f4", "2009-01-01 14:23:08"); assertNotNull("Transaction 1 was not stored in cache", t1); ApiTransaction[] t2 = api_cache.getTransactionFor("bad7e480", "2009-01-01 18:11:59"); assertNotNull("Transaction 2 was not stored in cache", t2); }
@Test public void transactionAreExpiredAtCorrectTime() throws Exception { api_cache.setReportExpirationInterval(5L); api_cache.report(createTransactionData()); Thread.sleep(1000L); ApiTransaction[] t1 = api_cache.getTransactionFor("bce4c8f4", "2009-01-01 14:23:08"); assertNull("Transaction 1 was still in cache", t1); ApiTransaction[] t2 = api_cache.getTransactionFor("bad7e480", "2009-01-01 18:11:59"); assertNull("Transaction 2 was was still in cache", t2); }