### Question:
AutoLock implements AutoCloseable, Lock { @Override public void close() { unlock(); } AutoLock();  AutoLock(Lock lock); AutoLock autoLock(); @Override void close(); @Override void lock(); @Override void lockInterruptibly(); @Override boolean tryLock(); @Override boolean tryLock(long time, TimeUnit unit); @Override void unlock(); @Override Condition newCondition(); @Override String toString();  }### Answer:
@Test public void testClose() { ReentrantLock lock = new ReentrantLock(); assertFalse(lock.isHeldByCurrentThread()); AutoLock al = new AutoLock(lock); assertFalse(lock.isHeldByCurrentThread()); al.autoLock(); assertTrue(lock.isHeldByCurrentThread()); al.close(); assertFalse(lock.isHeldByCurrentThread()); }