public void addFileSystemConfigurationInFirstProject() {
    final PMDProjectPropertyDialogBot dialog =
        JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_1);
    assertTrue("PMD should be enabled", dialog.enablePMD().isChecked());
    assertTrue(
        "The button to add a new configuration should be enabled when PMD is enabled",
        dialog.addConfiguration().isEnabled());

    dialog.addConfiguration().click();
    final AddRuleSetConfigurationWizardBot wizard = AddRuleSetConfigurationWizardBot.getActive();
    assertFalse(
        "The finish button should be disabled as long as the name is missing",
        wizard.finish().isEnabled());

    wizard.filesystem().click();
    wizard.next().click();
    assertFalse(
        "The finish button should be disabled as long as the name is missing",
        wizard.finish().isEnabled());

    wizard.name().setText(FILE_SYSTEM_CONFIGURATION_NAME);
    assertFalse(
        "The finish button should be disabled as long as the location is missing",
        wizard.finish().isEnabled());

    wizard.location().setText(rules.getAbsolutePath());
    wizard.bot().waitUntil(Conditions.tableHasRows(wizard.rules(), 2));
    final String[] expectedNames = new String[] {"ExtendsObject", "BooleanInstantiation"};
    final String[] actualNames = wizard.ruleNames();
    assertArrayEquals("Rules of the PMD configuration", expectedNames, actualNames);
    assertTrue(
        "The finish button should be enabled if bot a name and a location with a valid configuration is available",
        wizard.finish().isEnabled());

    wizard.finish().click();
    wizard.bot().waitUntil(Conditions.shellCloses(wizard));
    dialog.bot().waitUntil(Conditions.tableHasRows(dialog.configurations(), 1));
    assertTrue(
        "The added configuration should be activated",
        dialog.configurations().getTableItem(0).isChecked());
    assertEquals(
        "Name of the configuration",
        FILE_SYSTEM_CONFIGURATION_NAME,
        dialog.configurations().cell(0, "Name"));
    assertEquals(
        "Type of the configuration", "File System", dialog.configurations().cell(0, "Type"));
    assertEquals(
        "Location of the configuration",
        rules.getAbsolutePath(),
        dialog.configurations().cell(0, "Location"));

    dialog.ok().click();
    dialog.bot().waitUntil(Conditions.shellCloses(dialog));
  }
  private void addWorkspaceConfigurationInFirstProject() {
    final PMDProjectPropertyDialogBot dialog =
        JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_1);
    assertTrue("PMD should be enabled", dialog.enablePMD().isChecked());
    assertTrue(
        "The button to add a new configuration should be enabled when PMD is enabled",
        dialog.addConfiguration().isEnabled());

    dialog.enablePMD().select();
    dialog.addConfiguration().click();
    final AddRuleSetConfigurationWizardBot wizard = AddRuleSetConfigurationWizardBot.getActive();
    assertFalse(
        "The finish button should be disabled as long as the name is missing",
        wizard.finish().isEnabled());

    wizard.workspace().click();
    wizard.next().click();
    assertFalse(
        "The finish button should be disabled as long as the name is missing",
        wizard.finish().isEnabled());

    wizard.name().setText(WORKSPACE_CONFIGURATION_NAME);
    assertFalse(
        "The finish button should be disabled as long as the location is missing",
        wizard.finish().isEnabled());

    final String workspaceRelativePath = Paths.get(PROJECT_NAME_1).resolve(PMD_XML).toString();
    wizard.location().setText(workspaceRelativePath);
    wizard.bot().waitUntil(Conditions.tableHasRows(wizard.rules(), 2));
    final String[] expectedNames = new String[] {"ExtendsObject", "BooleanInstantiation"};
    final String[] actualNames = wizard.ruleNames();
    assertArrayEquals("Rules of the PMD configuration", expectedNames, actualNames);
    assertTrue(
        "The finish button should be enabled if bot a name and a location with a valid configuration is available",
        wizard.finish().isEnabled());

    wizard.finish().click();
    wizard.bot().waitUntil(Conditions.shellCloses(wizard));
    dialog.bot().waitUntil(Conditions.tableHasRows(dialog.configurations(), 2));
    assertTrue(
        "The added configuration should be activated",
        dialog.configurations().getTableItem(1).isChecked());
    assertEquals(
        "Name of the configuration",
        WORKSPACE_CONFIGURATION_NAME,
        dialog.configurations().cell(1, "Name"));
    assertEquals("Type of the configuration", "Workspace", dialog.configurations().cell(1, "Type"));
    assertEquals(
        "Location of the configuration",
        workspaceRelativePath,
        dialog.configurations().cell(1, "Location"));

    dialog.ok().click();
    dialog.bot().waitUntil(Conditions.shellCloses(dialog));
  }