urn_perun_member_group_attribute_def_virt_groupStatus extends MemberGroupVirtualAttributesModuleAbstract implements MemberGroupVirtualAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, Member member, Group group, 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, Member member, Group group, Attribute attribute); @Override Attribute getAttributeValue(PerunSessionImpl sess, Member member, Group group, AttributeDefinition attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test public void testCheckAttributeValueNull() throws Exception { System.out.println("testCheckAttributeValueNull()"); attributeToCheck.setValue(null); classInstance.checkAttributeSyntax(session, new Member(), new Group(), attributeToCheck); }
@Test public void testCheckAttributeValueCorrect() throws Exception { System.out.println("testCheckAttributeValueCorrect()"); attributeToCheck.setValue("VALID"); classInstance.checkAttributeSyntax(session, new Member(), new Group(), attributeToCheck); attributeToCheck.setValue("EXPIRED"); classInstance.checkAttributeSyntax(session, new Member(), new Group(), attributeToCheck); }
@Test(expected = WrongAttributeValueException.class) public void testCheckAttributeWrongValue() throws Exception { System.out.println("testCheckAttributeWrongValue()"); attributeToCheck.setValue("SUSPENDED"); classInstance.checkAttributeSyntax(session, new Member(), new Group(), attributeToCheck); }