urn_perun_resource_attribute_def_def_homeMountPoints extends ResourceAttributesModuleAbstract implements ResourceAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, Resource resource, Attribute attribute) throws WrongAttributeValueException { if (attribute.getValue() == null) return; List<String> homeMountPoints = attribute.valueAsList(); if (!homeMountPoints.isEmpty()) { for (String st : homeMountPoints) { Matcher match = pattern.matcher(st); if (!match.matches()) { throw new WrongAttributeValueException(attribute, "Bad homeMountPoints attribute format " + st); } } } }  @Override Attribute fillAttribute(PerunSessionImpl perunSession, Resource resource, AttributeDefinition attribute); @Override void checkAttributeSyntax(PerunSessionImpl perunSession, Resource resource, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl perunSession, Resource resource, Attribute attribute); @Override List<String> getDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testSyntaxWithWrongValue() throws Exception { System.out.println("testSyntaxWithWrongValue()"); List<String> badValue = new ArrayList<>(); badValue.add("bad_example"); attributeToCheck.setValue(badValue); classInstance.checkAttributeSyntax(sess, resource, attributeToCheck); }
@Test public void testSyntaxCorrect() throws Exception { System.out.println("testSyntaxCorrect()"); classInstance.checkAttributeSyntax(sess, resource, attributeToCheck); }