@Test
public void testGivenValue() {

	String overrideValue = "text-" + System.currentTimeMillis();
	// prepare identity
	IdmRoleDto role = getHelper().createRole();
	// prepare new form definition
	IdmFormDefinitionDto formDefinition = createFormDefinition();
	role.setIdentityRoleAttributeDefinition(formDefinition.getId());
	role = roleService.save(role);
	// prepare form attribute 1
	String attrCode1 = getHelper().createName();
	String attrDefaultValue1 = "666";
	IdmFormAttributeDto att1 = createAttribute(attrCode1, attrDefaultValue1, PersistentType.LONG,
			formDefinition.getId());
	roleFormAttributeService.addAttributeToSubdefintion(role, att1);
	// prepare form attribute 2
	String attrCode2 = getHelper().createName();
	String attrDefaultValue2 = getHelper().createName() + getHelper().createName();
	IdmFormAttributeDto att2 = createAttribute(attrCode2, attrDefaultValue2, PersistentType.SHORTTEXT,
			formDefinition.getId());
	roleFormAttributeService.addAttributeToSubdefintion(role, att2);
	// prepare form attribute 3 without default value
	String attrCode3 = getHelper().createName();
	IdmFormAttributeDto att3 = createAttribute(attrCode3, null, PersistentType.SHORTTEXT, formDefinition.getId());
	roleFormAttributeService.addAttributeToSubdefintion(role, att3);
	IdmConceptRoleRequestDto roleRequestDto = new IdmConceptRoleRequestDto();
	roleRequestDto.setRole(role.getId());
	IdmFormInstanceDto formInstanceDto = new IdmFormInstanceDto();
	formInstanceDto.setFormDefinition(formDefinition);
	IdmFormValueDto formValueDto = new IdmFormValueDto();
	formValueDto.setFormAttribute(att2.getId());
	formValueDto.setShortTextValue(overrideValue);
	formInstanceDto.setValues(Lists.newArrayList(formValueDto));
	roleRequestDto.getEavs().clear();
	roleRequestDto.getEavs().add(formInstanceDto);
	// check eav before
	List<IdmFormInstanceDto> eavs = roleRequestDto.getEavs();
	assertFalse(eavs.isEmpty());
	createGenerator();
	// generate and check values after
	roleRequestDto = this.valueGeneratorManager.generate(roleRequestDto);
	eavs = roleRequestDto.getEavs();
	assertFalse(eavs.isEmpty());
	// get newly generated eav only for given form definition
	IdmFormInstanceDto generatedEav = eavs.stream()
			.filter(eav -> eav.getFormDefinition().getCode().equals(formDefinition.getCode())).findFirst()
			.orElse(null);
	assertNotNull(generatedEav);
	// check values
	List<IdmFormValueDto> values = generatedEav.getValues().stream()
			.filter(val -> val.getFormAttribute().equals(att1.getId())).collect(Collectors.toList());
	assertEquals(1, values.size());
	IdmFormValueDto value = values.get(0);
	assertEquals(attrDefaultValue1, value.getValue().toString());
	values = generatedEav.getValues().stream().filter(val -> val.getFormAttribute().equals(att2.getId()))
			.collect(Collectors.toList());
	assertEquals(1, values.size());
	value = values.get(0);
	assertNotEquals(attrDefaultValue2, value.getValue().toString());
	assertEquals(overrideValue, value.getValue().toString());
	values = generatedEav.getValues().stream().filter(val -> val.getFormAttribute().equals(att3.getId()))
			.collect(Collectors.toList());
	assertEquals(0, values.size());
}