@Test public void closesLockAndChannel() throws Exception { FileCloseLock lock = new FileCloseLock(channel, fileLock); lock.close(); InOrder inOrder = inOrder(channel, fileLock); inOrder.verify(fileLock).close(); inOrder.verify(channel).close(); }
@Override @SuppressWarnings("try") public void close() throws IOException { try ( Owner<Channel, IOException> channelOwner = own(channel, IOException.class); Owner<FileLock, IOException> fileLockOwner = own(fileLock, IOException.class); ) { } }
FileCloseLock implements CloseLock { @Override @SuppressWarnings("try") public void close() throws IOException { try ( Owner<Channel, IOException> channelOwner = own(channel, IOException.class); Owner<FileLock, IOException> fileLockOwner = own(fileLock, IOException.class); ) { } } }
FileCloseLock implements CloseLock { @Override @SuppressWarnings("try") public void close() throws IOException { try ( Owner<Channel, IOException> channelOwner = own(channel, IOException.class); Owner<FileLock, IOException> fileLockOwner = own(fileLock, IOException.class); ) { } } FileCloseLock(Channel channel, FileLock fileLock); }
FileCloseLock implements CloseLock { @Override @SuppressWarnings("try") public void close() throws IOException { try ( Owner<Channel, IOException> channelOwner = own(channel, IOException.class); Owner<FileLock, IOException> fileLockOwner = own(fileLock, IOException.class); ) { } } FileCloseLock(Channel channel, FileLock fileLock); @Override @SuppressWarnings("try") void close(); }
FileCloseLock implements CloseLock { @Override @SuppressWarnings("try") public void close() throws IOException { try ( Owner<Channel, IOException> channelOwner = own(channel, IOException.class); Owner<FileLock, IOException> fileLockOwner = own(fileLock, IOException.class); ) { } } FileCloseLock(Channel channel, FileLock fileLock); @Override @SuppressWarnings("try") void close();  }