urn_perun_group_attribute_def_def_adName_o365mu extends GroupAttributesModuleAbstract implements GroupAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute) throws WrongAttributeValueException { if (attribute.getValue() == null) return; if (!pattern.matcher(attribute.valueAsString()).matches()) { throw new WrongAttributeValueException(attribute, "Invalid attribute adName value. It should contain only letters, digits, hyphens, underscores or dots."); } }  @Override void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute); @Override List<String> getDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testWrongSyntax() throws Exception { System.out.println("testWrongValue()"); attributeToCheck.setValue("bad@value"); when(resourcesManagerBl.getAssignedResources(sess, group)) .thenReturn(Collections.singletonList(resource1)); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }
@Test public void testCorrectSyntax() throws Exception { System.out.println("testCorrectSyntax()"); attributeToCheck.setValue("correctValue"); when(resourcesManagerBl.getAssignedResources(sess, group)) .thenReturn(Collections.singletonList(resource1)); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }