final ScopeType scope = ScopeType.IMPORT;
final boolean optional = true;
final MavenCoordinate coordinate = new MavenCoordinateImpl(groupId, artifactId, version, packaging, classifier);
final MavenDependencyExclusion exclusion1 = new MavenDependencyExclusionImpl("groupId1", "artifactId1");
final MavenDependencyExclusion exclusion2 = new MavenDependencyExclusionImpl("groupId2", "artifactId2");
final MavenDependency dependency = new MavenDependencyImpl(coordinate, scope, optional, exclusion1, exclusion2);
Assert.assertEquals(groupId, dependency.getGroupId());
Assert.assertEquals(artifactId, dependency.getArtifactId());
Assert.assertEquals(version, dependency.getVersion());
Assert.assertEquals(packaging, dependency.getPackaging());
Assert.assertEquals(classifier, dependency.getClassifier());
final Set<MavenDependencyExclusion> exclusions = dependency.getExclusions();
Assert.assertEquals(2, exclusions.size());
final Iterator<MavenDependencyExclusion> it = exclusions.iterator();
final MavenDependencyExclusion roundtrip1 = it.next();
Assert.assertTrue(exclusions.contains(roundtrip1));
final MavenDependencyExclusion roundtrip2 = it.next();
Assert.assertTrue(exclusions.contains(roundtrip2));
Assert.assertEquals(groupId + ":" + artifactId + ":" + packaging.toString() + ":" + classifier + ":" + version
+ ":" + scope, dependency.toCanonicalForm());
}