@Test
public void testRelatedGroups() {

	CouplingInstance group1 = new CouplingInstance();
	CouplingInstance group2 = new CouplingInstance();
	CouplingInstance group3 = new CouplingInstance();
	Nanoentity nanoentity1a = createNanoEntity("1A");
	Nanoentity nanoentity1b = createNanoEntity("1B");
	group1.setNanoentities(Arrays.asList(nanoentity1a, nanoentity1b));
	Nanoentity nanoentity2a = createNanoEntity("2A");
	Nanoentity nanoentity2b = createNanoEntity("2B");
	group2.setNanoentities(Arrays.asList(nanoentity2a, nanoentity2b));
	Nanoentity nanoentity3a = createNanoEntity("3A");
	Nanoentity nanoentity3b = createNanoEntity("3B");
	group3.setNanoentities(Arrays.asList(nanoentity3a, nanoentity3b));
	Nanoentity other = createNanoEntity("other");
	RelatedGroupCriteriaScorer scorer = new RelatedGroupCriteriaScorer(PENALTY, PREMIUM,
			Arrays.asList(nanoentity1a, nanoentity1b, nanoentity2a, nanoentity2b, nanoentity3a, nanoentity3b, other));
	Map<EntityPair, Double> scores = scorer.getScores(new HashSet<CouplingInstance>(Arrays.asList(group1, group2, group3)));
	// check premiums
	assertThat(scores.get(new EntityPair(nanoentity1a, nanoentity1b)), is(equalTo(PREMIUM)));
	assertThat(scores.get(new EntityPair(nanoentity2a, nanoentity2b)), is(equalTo(PREMIUM)));
	assertThat(scores.get(new EntityPair(nanoentity3a, nanoentity3b)), is(equalTo(PREMIUM)));
	// check penalties
	assertThat(scores.get(new EntityPair(nanoentity1a, nanoentity2b)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity1a, nanoentity2a)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity1a, nanoentity3b)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity1a, nanoentity3a)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity1b, nanoentity2a)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity1b, nanoentity2b)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity1b, nanoentity3a)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity1b, nanoentity3b)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity2a, nanoentity3a)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity2a, nanoentity3b)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity2b, nanoentity3a)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity2b, nanoentity3b)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity1a, other)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity1b, other)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity2a, other)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity2b, other)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity3a, other)), is(equalTo(PENALTY)));
	assertThat(scores.get(new EntityPair(nanoentity3b, other)), is(equalTo(PENALTY)));
}