@Test
  public void testGenerateUniqueOperationIds() {
    final File output = folder.getRoot();

    final Swagger swagger =
        new SwaggerParser().read("src/test/resources/2_0/duplicateOperationIds.yaml");
    CodegenConfig codegenConfig = new JavaClientCodegen();
    codegenConfig.setOutputDir(output.getAbsolutePath());

    ClientOptInput clientOptInput =
        new ClientOptInput().opts(new ClientOpts()).swagger(swagger).config(codegenConfig);

    DefaultGenerator generator = new DefaultGenerator();
    generator.opts(clientOptInput);

    Map<String, List<CodegenOperation>> paths = generator.processPaths(swagger.getPaths());
    Set<String> opIds = new HashSet<String>();
    for (String path : paths.keySet()) {
      List<CodegenOperation> ops = paths.get(path);
      for (CodegenOperation op : ops) {
        assertFalse(opIds.contains(op.operationId));
        opIds.add(op.operationId);
      }
    }
  }
  @Test
  public void testSkipOverwrite() throws Exception {
    final File output = folder.getRoot();

    final Swagger swagger = new SwaggerParser().read("src/test/resources/petstore.json");
    CodegenConfig codegenConfig = new JavaClientCodegen();
    codegenConfig.setOutputDir(output.getAbsolutePath());

    ClientOptInput clientOptInput =
        new ClientOptInput().opts(new ClientOpts()).swagger(swagger).config(codegenConfig);

    // generate content first time without skipOverwrite flag, so all generated files should be
    // recorded
    new DefaultGenerator().opts(clientOptInput).generate();
    final File order = new File(output, MODEL_ORDER_FILE);
    assertTrue(order.exists());

    // change content of one file
    changeContent(order);

    // generate content second time without skipOverwrite flag, so changed file should be rewritten
    new DefaultGenerator().opts(clientOptInput).generate();

    assertTrue(
        !TEST_SKIP_OVERWRITE.equals(FileUtils.readFileToString(order, StandardCharsets.UTF_8)));

    // change content again
    changeContent(order);
    // delete file
    final File pom = new File(output, POM_FILE);
    if (!pom.delete()) {
      fail();
    }

    // generate content third time with skipOverwrite flag, so changed file should not be rewritten
    // and deleted file should be recorded
    codegenConfig.setSkipOverwrite(true);
    new DefaultGenerator().opts(clientOptInput).generate();
    assertEquals(FileUtils.readFileToString(order, StandardCharsets.UTF_8), TEST_SKIP_OVERWRITE);
    assertTrue(pom.exists());
  }