urn_perun_vo_attribute_def_def_membershipExpirationRules extends AbstractMembershipExpirationRulesModule<Vo> implements VoAttributesModuleImplApi { @Override public void checkAttributeSemantics(PerunSessionImpl perunSession, Vo entity, Attribute attribute) throws WrongReferenceAttributeValueException { super.checkAttributeSemantics(perunSession, entity, attribute); }  @Override void changedAttributeHook(PerunSessionImpl session, Vo vo, Attribute attribute); @Override Attribute fillAttribute(PerunSessionImpl sess, Vo vo, AttributeDefinition attribute); @Override void checkAttributeSemantics(PerunSessionImpl perunSession, Vo entity, Attribute attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test public void autoExtensionLastLoginPeriodCorrectSemantics() throws Exception { Map<String, String> value = new LinkedHashMap<>(); when(session.getPerunBl().getExtSourcesManagerBl().getExtSourceById(any(), anyInt())) .thenReturn(new ExtSource()); value.put(autoExtensionExtSources, "3"); attributeToCheck.setValue(value); classInstance.checkAttributeSemantics(session, vo, attributeToCheck); }
@Test public void autoExtensionExtSourcesInCorrectSemantics() throws Exception { Map<String, String> value = new LinkedHashMap<>(); when(session.getPerunBl().getExtSourcesManagerBl().getExtSourceById(any(), anyInt())) .thenThrow(ExtSourceNotExistsException.class); value.put(autoExtensionExtSources, "3"); attributeToCheck.setValue(value); assertThatExceptionOfType(WrongReferenceAttributeValueException.class) .isThrownBy(() -> classInstance.checkAttributeSemantics(session, vo, attributeToCheck)); }
@Test public void autoExtensionMultipleExtSourcesCorrectSemantics() throws Exception { Map<String, String> value = new LinkedHashMap<>(); when(session.getPerunBl().getExtSourcesManagerBl().getExtSourceById(any(), anyInt())) .thenReturn(new ExtSource()); value.put(autoExtensionExtSources, "3,2"); attributeToCheck.setValue(value); classInstance.checkAttributeSemantics(session, vo, attributeToCheck); }