urn_perun_facility_attribute_def_def_rtOutputFileName extends FacilityAttributesModuleAbstract implements FacilityAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, Facility facility, Attribute attribute) throws WrongAttributeValueException { if (attribute.getValue() == null) { return; } String value = attribute.valueAsString(); Matcher matcher = fileNamePattern.matcher(value); if (!matcher.matches()) { throw new WrongAttributeValueException(attribute, facility, "Name of the file can contain only alphabet, numeric, dash and underscore characters."); } }  @Override void checkAttributeSyntax(PerunSessionImpl perunSession, Facility facility, Attribute attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testCheckAttributeSyntaxWithIncorrectValue() throws Exception { System.out.println("testCheckAttributeSyntaxWithIncorrectValue()"); attributeToCheck.setValue("/bad_example"); classInstance.checkAttributeSyntax(session, facility, attributeToCheck); }
@Test public void testCheckAttributeSyntaxCorrect() throws Exception { System.out.println("testCheckAttributeSyntaxCorrect()"); attributeToCheck.setValue("example"); classInstance.checkAttributeSyntax(session, facility, attributeToCheck); }