public FileOutputStream openOutputStream(File file, boolean append) {
    try {
      return openOutputStreamOrThrowIOE(file, append);
    } catch (IOException e) {
      throw new IllegalStateException("Can not open file " + file, e);
    }
  }
@Test
  public void openOutputStream_throws_ISE_if_file_is_a_directory() throws Exception {
    File dir = temp.newFolder();

    assertThatThrownBy(() -> underTest.openOutputStream(dir, false))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Can not open file " + dir)
      .hasRootCauseMessage("File " + dir + " exists but is a directory");
  }