@Test
public void testWhiteSpacesInUsername() {

	String firstName = "  first name-test   ";
	String lastName = "l    astNa me";
	String firstNameResult = "firstname-test";
	String lastNameResult = "lastname";
	String emailSuffix = "@example.tld";
	IdmIdentityDto identityDto = new IdmIdentityDto();
	identityDto.setFirstName(firstName);
	identityDto.setLastName(lastName);
	
	ValueGeneratorDto generator = getGenerator();
	this.createGenerator(getDtoType(), getGeneratorType(),
			this.createConfiguration(generator.getFormDefinition(), ImmutableMap.of(
					IdentityEmailGenerator.EMAIL_SUFFIX, emailSuffix,
					IdentityEmailGenerator.GENERATE_FROM_USERNAME, Boolean.FALSE.toString())), 1, null);
	IdmIdentityDto generatedDto = valueGeneratorManager.generate(identityDto);
	assertNotNull(generatedDto.getEmail());
	assertEquals(lastNameResult + firstNameResult + emailSuffix, generatedDto.getEmail());
}