public static void cleanDirectory(File directory) throws IOException {
    requireNonNull(directory, DIRECTORY_CAN_NOT_BE_NULL);
    if (!directory.exists()) {
      return;
    }

    cleanDirectoryImpl(directory.toPath());
  }
@Test
  public void cleanDirectory_throws_IAE_if_argument_is_a_file() throws IOException {
    File file = temporaryFolder.newFile();

    assertThatThrownBy(() -> FileUtils2.cleanDirectory(file))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("'" + file.getAbsolutePath() + "' is not a directory");
  }