Exemplo n.º 1
0
  @Test
  public void testGetCommandLineValue() throws JSAPException {
    FlexCPD.areCommandLineOptionsCorrect(
        new String[] {"-s", "sourceDirectory", "-o", "target", "-m", "25"});

    assertEquals("sourceDirectory", FlexCPD.getParameterValue(CommandLineOptions.SOURCE_DIRECTORY));
    assertEquals("target", FlexCPD.getParameterValue(CpdCommandLineOptions.OUTPUT_FILE));
    assertEquals("25", FlexCPD.getParameterValue(CpdCommandLineOptions.MINIMUM_TOKENS));
  }
Exemplo n.º 2
0
  @Test
  public void testAreCommandLineOptionsCorrect()
      throws FileNotFoundException, JSAPException, PMDException, URISyntaxException {
    assertFalse(FlexCPD.areCommandLineOptionsCorrect(new String[] {}));

    assertFalse(
        FlexCPD.areCommandLineOptionsCorrect(
            new String[] {"-y", "sourceDirectory", "-p", "outPutDirectory"}));

    assertTrue(
        FlexCPD.areCommandLineOptionsCorrect(
            new String[] {"-s", "sourceDirectory", "-o", "target", "-m", "50"}));

    assertTrue(
        FlexCPD.areCommandLineOptionsCorrect(
            new String[] {"-s", "sourceDirectory", "-o", "target"}));
  }
Exemplo n.º 3
0
  @Test
  public void testStartFlexCPD()
      throws JSAPException, PMDException, URISyntaxException, IOException, ReportException {
    final String[] args =
        new String[] {
          "-s",
          getTestDirectory().getAbsolutePath(),
          "-o",
          new File("target/cpd.xml").getAbsolutePath(),
          "--excludePackage",
          "cairngorm."
        };

    FlexCPD.startFlexCPD(args);
  }