urn_perun_user_facility_attribute_def_virt_groupStatus extends UserFacilityVirtualAttributesModuleAbstract implements UserFacilityVirtualAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, User user, Facility facility, Attribute attribute) throws WrongAttributeValueException { String status = attribute.valueAsString(); if (status == null) return; if (!"VALID".equals(status) && !"EXPIRED".equals(status)) throw new WrongAttributeValueException("Group status of member can be only 'VALID' or 'EXPIRED', not '"+status+"'"); }  @Override void checkAttributeSyntax(PerunSessionImpl perunSession, User user, Facility facility, Attribute attribute); @Override Attribute getAttributeValue(PerunSessionImpl sess, User user, Facility facility, AttributeDefinition attributeDefinition); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testSyntaxWithWrongStatus() throws Exception { System.out.println("testSyntaxWithWrongStatus()"); attributeToCheck.setValue("bad_example"); classInstance.checkAttributeSyntax(sess, user, facility, attributeToCheck); }
@Test public void testSyntaxCorrect() throws Exception { System.out.println("testSyntaxCorrect()"); attributeToCheck.setValue("VALID"); classInstance.checkAttributeSyntax(sess, user, facility, attributeToCheck); attributeToCheck.setValue("EXPIRED"); classInstance.checkAttributeSyntax(sess, user, facility, attributeToCheck); }