### Question:
AutoReadWriteLock implements ReadWriteLock { @Override public AutoLock writeLock() { return writeLock; } AutoReadWriteLock();  AutoReadWriteLock(ReadWriteLock lock); @Override AutoLock readLock(); @Override AutoLock writeLock(); AutoLock autoReadLock(); AutoLock autoWriteLock(); @Override String toString();  }### Answer:
@Test public void testWriteLock() { ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); AutoReadWriteLock al = new AutoReadWriteLock(lock); assertFalse(lock.isWriteLocked()); try (AutoLock al2 = al.autoWriteLock()) { assertTrue(lock.isWriteLocked()); } assertFalse(lock.isWriteLocked()); }