urn_perun_group_resource_attribute_def_def_o365EmailAddresses_mu extends GroupResourceAttributesModuleAbstract implements GroupResourceAttributesModuleImplApi { @Override public Attribute fillAttribute(PerunSessionImpl sess, Group group, Resource resource, AttributeDefinition attrDef) throws WrongAttributeAssignmentException { if (!NAMESPACE.equals(attrDef.getNamespace())) throw new WrongAttributeAssignmentException(attrDef); try { Attribute result = new Attribute(attrDef); Object adName = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, resource, group, ADNAME_ATTRIBUTE).getValue(); if (adName != null && adName instanceof String) { result.setValue(Lists.newArrayList(adName + "@group.muni.cz")); } return result; } catch (GroupResourceMismatchException | AttributeNotExistsException e) { throw new InternalErrorException(e.getMessage(), e); } }  @Override void checkAttributeSyntax(PerunSessionImpl sess, Group group, Resource resource, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl sess, Group group, Resource resource, Attribute attribute); @Override Attribute fillAttribute(PerunSessionImpl sess, Group group, Resource resource, AttributeDefinition attrDef); @Override List<String> getDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test public void fillAttribute() throws Exception { System.out.println("fillAttribute()"); Attribute attribute = classInstance.fillAttribute(session, group, resource, classInstance.getAttributeDefinition()); Object attributeValue = attribute.getValue(); assertThat(attributeValue, is(notNullValue())); List<String> expectedValue = new ArrayList<>(); expectedValue.add(adName + "@group.muni.cz"); assertThat(attributeValue, equalTo(expectedValue)); when(am.getPerunBeanIdsForUniqueAttributeValue(eq(session), argThat(new BeanAttributeMatcher("group_resource")))) .thenReturn(Sets.newHashSet(new Pair<>(group.getId(),resource.getId()))); when(am.getPerunBeanIdsForUniqueAttributeValue(eq(session), argThat(new BeanAttributeMatcher("member")))) .thenReturn(Sets.newHashSet()); classInstance.checkAttributeSemantics(session, group, resource, attribute); }