@Test
public void importTwoNanoentitiesWithSameName() {

	// Given
	Entity user = createEntity("User", "name");
	Entity company = createEntity("Company", "name");
	Entity stock = createEntity("Stock", "name");
	List<Entity> entities = Arrays.asList(company, user, stock);
	EntityRelationDiagram erd = new EntityRelationDiagram();
	erd.setEntities(entities);
	List<EntityRelation> relations = Arrays.asList(new EntityRelation(user, company, RelationType.COMPOSITION));
	erd.setRelations(relations);
	// When
	importer.importERD(erd);
	// Then
	List<Nanoentity> nanoentities = Lists.newArrayList(nanoentityRepository.findAll());
	assertThat(nanoentities, hasSize(3));
	List<String> contextNames = nanoentities.stream().map(Nanoentity::getContextName).collect(toList());
	assertThat(contextNames, containsInAnyOrder("User.name", "Company.name", "Stock.name"));
	// only two instances of SAME_ENTITY
	List<CouplingInstance> couplings = Lists.newArrayList(couplingInstanceRepository.findAll());
	assertThat(couplings.stream().map(CouplingInstance::getType).collect(toList()), containsInAnyOrder(InstanceType.SAME_ENTITY, InstanceType.SAME_ENTITY));
	assertThat(couplings.stream().map(CouplingInstance::getName).collect(toList()), containsInAnyOrder("User", "Stock"));
}