urn_perun_user_attribute_def_def_login_namespace_eduroam_vsup extends urn_perun_user_attribute_def_def_login_namespace { @Override public void checkAttributeSemantics(PerunSessionImpl sess, User user, Attribute attribute) throws WrongAttributeAssignmentException, WrongReferenceAttributeValueException { try { Attribute a = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, VSUP_NAMESPACE); if (!Objects.equals(attribute.getValue(),a.getValue())) { throw new WrongReferenceAttributeValueException(attribute, a, user, null, user, null, "Eduroam login must match VŠUP login "+a.getValue()); } } catch (AttributeNotExistsException ex) { throw new ConsistencyErrorException("Login namespace attribute for VŠUP must exists.", ex); } super.checkAttributeSemantics(sess, user, attribute); }  @Override void checkAttributeSyntax(PerunSessionImpl sess, User user, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl sess, User user, Attribute attribute); @Override Attribute fillAttribute(PerunSessionImpl perunSession, User user, AttributeDefinition attribute); @Override List<String> getDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test public void testCorrectSemantics() throws Exception { System.out.println("testCheckAttributeSyntax()"); String value = "same_value"; attributeToCheck.setValue(value); classInstance.checkAttributeSemantics(session, user, attributeToCheck); }
@Test(expected = WrongReferenceAttributeValueException.class) public void testCheckAttributeSemanticsWithWrongValue() throws Exception { System.out.println("testCheckAttributeSyntaxWithWrongValue()"); String value = "not_same_value"; attributeToCheck.setValue(value); classInstance.checkAttributeSemantics(session, user, attributeToCheck); }