urn_perun_user_facility_attribute_def_def_shell_passwd_scp extends UserFacilityAttributesModuleAbstract implements UserFacilityAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl sess, User user, Facility facility, Attribute attribute) throws WrongAttributeValueException { String shell = attribute.valueAsString(); if(shell == null) return; Matcher matcher = pattern.matcher(shell); if(!matcher.matches()) throw new WrongAttributeValueException(attribute, "Wrong format. ^(/[-_.A-z0-9]+)+$ expected"); }  @Override void checkAttributeSyntax(PerunSessionImpl sess, User user, Facility facility, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl sess, User user, Facility facility, Attribute attribute); @Override Attribute fillAttribute(PerunSessionImpl sess, User user, Facility facility, AttributeDefinition attributeDefinition); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testSyntaxWithWrongFormat() throws Exception { System.out.println("testSyntaxWithWrongFormat()"); attributeToCheck.setValue("bad_example"); classInstance.checkAttributeSyntax(sess, user, facility, attributeToCheck); }
@Test public void testSyntaxCorrect() throws Exception { System.out.println("testSyntaxCorrect()"); attributeToCheck.setValue("/example"); classInstance.checkAttributeSyntax(sess, user, facility, attributeToCheck); }