@Test(groups = { TestUtils.UNIT })
public void testAssociationsWithLists() {
ArtifactObject b1 = createBasicArtifactObject("b1");
ArtifactObject b2 = createBasicArtifactObject("b2");
ArtifactObject b3 = createBasicArtifactObject("b3");
FeatureObject g1 = createBasicFeatureObject("g1");
FeatureObject g2 = createBasicFeatureObject("g2");
FeatureObject g3 = createBasicFeatureObject("g3");
List<ArtifactObject> artifacts = new ArrayList<ArtifactObject>();
artifacts.add(b1);
artifacts.add(b2);
List<FeatureObject> features = new ArrayList<FeatureObject>();
features.add(g1);
features.add(g3);
Artifact2FeatureAssociation bg = m_artifact2FeatureRepository.create(artifacts, features);
assert bg.getLeft().size() == 2 : "We expect two artifacts on the left side of the association.";
assert bg.getRight().size() == 2 : "We expect two features on the right side of the association.";
assert bg.getLeft().contains(b1) : "b1 should be on the left side of the association.";
assert bg.getLeft().contains(b2) : "b2 should be on the left side of the association.";
assert !bg.getLeft().contains(b3) : "b3 should not be on the left side of the association.";
assert bg.getRight().contains(g1) : "g1 should be on the right side of the association.";
assert !bg.getRight().contains(g2) : "g2 should not be on the right side of the association.";
assert bg.getRight().contains(g3) : "g3 should be on the right side of the association.";
List<FeatureObject> foundFeatures = b1.getFeatures();
assert foundFeatures.size() == 2 : "b1 should be associated with two features.";
assert foundFeatures.contains(g1) : "b1 should be associated with g1";
assert !foundFeatures.contains(g2) : "b1 not should be associated with g2";
assert foundFeatures.contains(g3) : "b1 should be associated with g3";
foundFeatures = b3.getFeatures();
assert foundFeatures.size() == 0 : "b3 should not be associated with any features.";
List<ArtifactObject> foundArtifacts = g3.getArtifacts();
assert foundArtifacts.size() == 2 : "g1 should be associated with two features.";
assert foundArtifacts.contains(b1) : "g1 should be associated with b1";
assert foundArtifacts.contains(b2) : "g1 should be associated with b2";
assert !foundArtifacts.contains(b3) : "g1 should not be associated with b3";
}