	@Test
	public void testExecuteReportTwoContract() throws JsonParseException, JsonMappingException, IOException {

		String roleCode = "test-" + System.currentTimeMillis(); 
		IdmTreeNodeDto treeNode = getHelper().createTreeNode();
		IdmIdentityDto identity = getHelper().createIdentity(new GuardedString());
		IdmIdentityContractDto contactOne = getHelper().createContract(identity, treeNode);
		IdmIdentityContractDto contactTwo = getHelper().createContract(identity, treeNode);
		
		IdmRoleDto role = getHelper().createRole(roleCode);

		getHelper().createIdentityRole(contactOne, role);
		getHelper().createIdentityRole(contactOne, role);
		getHelper().createIdentityRole(contactTwo, role);
		getHelper().createIdentityRole(contactTwo, role);

		RptReportDto report = new RptReportDto(UUID.randomUUID());
		report.setExecutorName(reportExecutor.getName());
		IdmFormDto filter = new IdmFormDto();
		IdmFormDefinitionDto definition = reportExecutor.getFormDefinition();
		IdmFormValueDto treeNodeParameter = new IdmFormValueDto(definition.getMappedAttributeByCode(IdentityRoleByIdentityDeduplicationExecutor.PARAMETER_TREE_NODE));
		treeNodeParameter.setValue(treeNode.getId());
		filter.getValues().add(treeNodeParameter);
		filter.setFormDefinition(definition.getId());
		report.setFilter(filter);

		report = reportExecutor.generate(report);
		Assert.assertNotNull(report.getData());
		List<RptIdentityRoleByRoleDeduplicationDto> reportItems = mapper.readValue(
				attachmentManager.getAttachmentData(report.getData()), 
				new TypeReference<List<RptIdentityRoleByRoleDeduplicationDto>>(){});

		assertEquals(2, reportItems.size());
		for (RptIdentityRoleByRoleDeduplicationDto item : reportItems) {
			assertNotNull(item.getIdentity());
			assertEquals(identity.getId(), item.getIdentity().getId());
			assertNotNull(item.getWorkPosition());
			assertEquals(treeNode.getId(), item.getWorkPosition().getId());
			assertNotNull(item.getIdentityContract());
			if (item.getIdentityContract().getId().equals(contactOne.getId())) {
				// Success
			} else if (item.getIdentityContract().getId().equals(contactTwo.getId())) {
				// Success
			} else {
				fail();
			}
			List<RptIdentityRoleByRoleDeduplicationDuplicityDto> duplicities = item.getDuplicity();
			assertEquals(1, duplicities.size());
		}

		attachmentManager.deleteAttachments(report);
	}