CleaningLeaseMaintainer implements LeaseMaintainer { @Override public void waitForLease() throws InterruptedException { delegate.waitForLease(); } CleaningLeaseMaintainer(LeaseMaintainer delegate, Connection connection, Closeable... resources); private  CleaningLeaseMaintainer(LeaseMaintainer delegate, Connection connection, List<Closeable> resources); @Override Lease getCurrentLease(); @Override void waitForLease(); @Override boolean waitForLease(long timeout, TimeUnit timeUnit); @Override void close(); @Override void destroy();  }
@Test public void delegatesWaitForLease() throws Exception { CleaningLeaseMaintainer cleaner = new CleaningLeaseMaintainer(delegate, connection, thread1, thread2); cleaner.waitForLease(); verify(delegate).waitForLease(); }
@Test public void delegatesWaitForLeaseTimeout() throws Exception { CleaningLeaseMaintainer cleaner = new CleaningLeaseMaintainer(delegate, connection, thread1, thread2); cleaner.waitForLease(10, TimeUnit.SECONDS); verify(delegate).waitForLease(10, TimeUnit.SECONDS); }