urn_perun_group_attribute_def_def_authoritativeGroup extends GroupAttributesModuleAbstract implements GroupAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) return; Integer value = attribute.valueAsInteger(); if(value < 0 || value > 1) throw new WrongAttributeValueException(attribute, group, "Attribute can have only value 1 or 0 (true or false)."); }  @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 testCheckSmallValue() throws Exception { System.out.println("testCheckSmallValue()"); attributeToCheck.setValue(-1); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }
@Test(expected = WrongAttributeValueException.class) public void testCheckHighValue() throws Exception { System.out.println("testCheckHighValue()"); attributeToCheck.setValue(2); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }
@Test public void testCorrectSemantics() throws Exception { System.out.println("testCorrectSyntax()"); attributeToCheck.setValue(1); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }
@Test public void testCorrectSyntax() throws Exception { System.out.println("testCorrectSyntax()"); attributeToCheck.setValue(0); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); attributeToCheck.setValue(1); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }