urn_perun_facility_attribute_def_def_scratchDirPermissions extends FacilityAttributesModuleAbstract implements FacilityAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, Facility facility, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) return; Matcher match = pattern.matcher(attribute.valueAsString()); if(!match.matches()) throw new WrongAttributeValueException(attribute, facility, "Bad format of attribute, (expected something like '750' or '0700')."); }  @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("750"); classInstance.checkAttributeSyntax(session, facility, attributeToCheck); }