### Question:
LdapGroupNameValidator implements ConstraintValidator<LdapGroupNameValidation, AcmGroup> { @Override public boolean isValid(AcmGroup acmGroup, ConstraintValidatorContext context) { if (acmGroup == null) { return false; } AcmGroupType groupType = acmGroup.getType(); String groupName = acmGroup.getName(); if (groupType == null) { return false; } if (groupType.equals(AcmGroupType.LDAP_GROUP)) { if (groupName.length() > 64) { return false; } } return true; }  @Override void initialize(LdapGroupNameValidation ldapGroupNameValidation); @Override boolean isValid(AcmGroup acmGroup, ConstraintValidatorContext context);  }### Answer:
@Test public void invalidLdapGroupNameLength() { AcmGroup acmGroup = new AcmGroup(); acmGroup.setName("ACM_ADMINISTATOR_DEV_TEST_VALIDATE_LDAP_GROUP_NAME_LENGTH_TESTTTTTTTTTTTTTTTTTTTTTTTT@ARMEDIA.COM"); acmGroup.setType(AcmGroupType.LDAP_GROUP); boolean res = unit.isValid(acmGroup, null); assertFalse(res); }
@Test public void validLdapGroupNameLength() { AcmGroup acmGroup = new AcmGroup(); acmGroup.setName("ACM_ADMINISTATOR_DEV@ARMEDIA.COM"); acmGroup.setType(AcmGroupType.LDAP_GROUP); boolean res = unit.isValid(acmGroup, null); assertTrue(res); }
@Test public void undefinedLdapGroupType() { AcmGroup acmGroup = new AcmGroup(); acmGroup.setName("ACM_ADMINISTATOR_DEV@ARMEDIA.COM"); acmGroup.setType(null); boolean res = unit.isValid(acmGroup, null); assertFalse(res); }