public void testAddExclusion_existingExclusion() throws Exception {
    document.setText(
        StructuredModelManager.getModelManager(), //
        "<project><dependencies>"
            + //
            "<dependency><groupId>AAA</groupId><artifactId>BBB</artifactId><version>1.0</version></dependency>"
            + //
            "<dependency><groupId>AAAB</groupId><artifactId>BBB</artifactId><version>1.0</version></dependency>"
            + //
            "<dependency><groupId>AAA</groupId><artifactId>BBBB</artifactId><version>1.0</version>"
            + //
            "<exclusions><exclusion><groupId>g</groupId><artifactId>b</artifactId><version>1.0</version></exclusion></exclusions></dependency>"
            + //
            "</dependencies></project>");
    PomEdits.performOnDOMDocument(new OperationTuple(tempModel, new AddExclusionOperation(d, e)));
    assertEquals(
        "Expected no dependency: " + d.toString() + "\n" + document.getText(),
        1,
        dependencyCount(tempModel, d));
    assertTrue(
        "Has exclusion " + e.toString() + "\n" + document.getText(), hasExclusion(tempModel, d, e));

    ArtifactKey key = new ArtifactKey("g", "b", "1.0", null);
    assertTrue(
        "Existing Exclusion Present " + key.toString() + "\n" + document.getText(),
        hasExclusion(tempModel, d, key));
    assertEquals("Exclusions", 2, getExclusionCount(tempModel, d));
    assertEquals("Dependency Count: \n" + document.getText(), 3, getDependencyCount(tempModel));
  }
 private ResolutionType getResolutionType(IMarker marker) {
   ArtifactKey key = getArtifactKey(marker);
   if (key != null) {
     if (key.getVersion().contains(REDHAT_SUFFIX)) {
       return ResolutionType.EAP_REPO;
     } else if (key.getGroupId().startsWith(ORG_JBOSS_PREFIX)) {
       return ResolutionType.JBOSS_REPO;
     }
   }
   return ResolutionType.UNSUPPORTED;
 }
  @Test
  public void testIdentify() throws Exception {
    MavenCentralIdentifier identifier = new MavenCentralIdentifier();
    ArtifactKey key;

    key = identifier.identify(groovy_jsr223, null);
    assertNotNull("groovy-jsr223 was not identifed", key);
    assertEquals("groovy-jsr223", key.getArtifactId());
    assertEquals("org.codehaus.groovy", key.getGroupId());
    assertEquals("2.0.4", key.getVersion());
  }