urn_perun_resource_attribute_def_def_k4GroupName extends ResourceAttributesModuleAbstract implements ResourceAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, Resource resource, Attribute attribute) throws WrongAttributeValueException { if (attribute.getValue() != null && (attribute.valueAsString()).length() > 40) throw new WrongAttributeValueException("Name of Group in K4 mustn't exceed 40 characters."); }  @Override void checkAttributeSyntax(PerunSessionImpl perunSession, Resource resource, Attribute attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testSyntaxWithWrongValue() throws Exception { System.out.println("testSyntaxWithWrongValue()"); attributeToCheck.setValue("testWithBadValueBecauseItIsToooooooooLong"); classInstance.checkAttributeSyntax(sess, resource, attributeToCheck); }
@Test public void testSyntaxCorrect() throws Exception { System.out.println("testSyntaxCorrect()"); attributeToCheck.setValue("example"); classInstance.checkAttributeSyntax(sess, resource, attributeToCheck); }