urn_perun_member_group_attribute_def_virt_isGroupAdmin extends MemberGroupVirtualAttributesModuleAbstract implements MemberGroupVirtualAttributesModuleImplApi { @Override public Attribute getAttributeValue(PerunSessionImpl sess, Member member, Group group, AttributeDefinition attributeDefinition) { List<User> userAdminList; User newUser; Attribute attribute = new Attribute(attributeDefinition); userAdminList = sess.getPerunBl().getGroupsManagerBl().getAdmins(sess, group, false); newUser = sess.getPerunBl().getUsersManagerBl().getUserByMember(sess, member); if (userAdminList.contains(newUser)) { attribute.setValue(true); return attribute; } attribute.setValue(false); return attribute; }  @Override Attribute getAttributeValue(PerunSessionImpl sess, Member member, Group group, AttributeDefinition attributeDefinition); @Override boolean setAttributeValue(PerunSessionImpl sess, Member member, Group group, Attribute attribute); @Override boolean removeAttributeValue(PerunSessionImpl sess, Member member, Group group, AttributeDefinition attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test public void testGetAttributeValueGroupAdmin() throws Exception { System.out.println("testGetAttributeValue() - isGroupAdmin"); attribute.setValue(true); Attribute testAttr = classInstance.getAttributeValue(session, member, group, attrDef); assertEquals(testAttr, attribute); }
@Test public void testGetAttributeValueNotGroupAdmin() throws Exception{ System.out.println("testGetAttributeValue() - isNotGroupAdmin"); attribute.setValue(false); groupsManager.removeAdmin(sess, group, user); Attribute testAttr = classInstance.getAttributeValue(session, member, group, attrDef); assertEquals(testAttr, attribute); }