urn_perun_group_attribute_def_def_synchronizationEnabled extends GroupAttributesModuleAbstract implements GroupAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) return; String attrValue = attribute.valueAsString(); if(!attrValue.equals("true") && !attrValue.equals("false")) { throw new WrongAttributeValueException(attribute, group, "If attribute is not null, only string 'true' or 'false' is correct format."); } }  @Override void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testWrongSyntax() throws Exception { System.out.println("testWrongSyntax()"); attributeToCheck.setValue("value"); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }
@Test public void testCorrectSyntax() throws Exception { System.out.println("testCorrectSyntax()"); attributeToCheck.setValue("true"); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); attributeToCheck.setValue("false"); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }