@Override
  public void close() throws IOException {
    if (isClosed) {
      return;
    }

    IOUtils.write(bufferWriter.toString(), outputWriter);
    outputWriter.close();
    this.isClosed = true;
  }
@Test
  public void close_encapsulated_writer_once() throws IOException {
    writer = mock(Writer.class);
    underTest = new CacheWriter(writer);

    underTest.close();
    underTest.close();

    verify(writer, times(1)).close();
  }