urn_perun_group_resource_attribute_def_def_vomsRoles extends GroupResourceAttributesModuleAbstract implements GroupResourceAttributesModuleImplApi { @Override @SuppressWarnings("unchecked") public void checkAttributeSyntax(PerunSessionImpl perunSession, Group group, Resource resource, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) { return; } List<String> vomRoles = attribute.valueAsList(); for (String vomRole : vomRoles) { Matcher matcher = pattern.matcher(vomRole); if(!matcher.matches()) { throw new WrongAttributeValueException(attribute, "Bad group vomsRoles value. It should not contain '<>&' characters."); } } }  @Override @SuppressWarnings("unchecked") void checkAttributeSyntax(PerunSessionImpl perunSession, Group group, Resource resource, Attribute attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testWrongValue() throws Exception { System.out.println("testWrongValue()"); List<String> value = new ArrayList<>(); value.add("<0"); attributeToCheck.setValue(value); classInstance.checkAttributeSyntax(sess, group, resource, attributeToCheck); }
@Test public void testCorrectSyntax() throws Exception { System.out.println("testCorrectSyntax()"); List<String> value = new ArrayList<>(); value.add("0"); attributeToCheck.setValue(value); classInstance.checkAttributeSyntax(sess, group, resource, attributeToCheck); }