AutoReadWriteLock extends ReentrantReadWriteLock { @Override public AutoWriteLock writeLock() { return writer; } AutoReadWriteLock();  AutoReadWriteLock(boolean fair); @Override AutoReadLock readLock(); @Override AutoWriteLock writeLock();  }
@Test void writelock() { WriteLock writer = when(mock(WriteLock.class).toString()).thenReturn("delegate").getMock(); var wrapper = new AutoWriteLock(new AutoReadWriteLock(), writer); wrapper.getHoldCount(); verify(writer).getHoldCount(); wrapper.isHeldByCurrentThread(); verify(writer).isHeldByCurrentThread(); }