urn_perun_group_attribute_def_def_groupSynchronizationTimes extends GroupAttributesModuleAbstract implements GroupAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) return; ArrayList<String> attrValues = attribute.valueAsList(); for (String attrValue : attrValues) { Matcher matcher = pattern.matcher(attrValue); if (!matcher.matches()) { throw new WrongAttributeValueException(attribute, group, "Some of values are not in format HH:MM or are not rounded to 5 minute. For example 08:50 or 20:55."); } } }  @Override void checkAttributeSyntax(PerunSessionImpl sess, Group group, Attribute attribute); @Override void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute); @Override List<String> getDependencies(); @Override AttributeDefinition getAttributeDefinition();  }
@Test(expected = WrongAttributeValueException.class) public void testWrongSyntax() throws Exception { System.out.println("testWrongSyntax()"); List<String> value = new ArrayList<>(); value.add("08:51"); attributeToCheck.setValue(value); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }
@Test public void testCorrectSyntax() throws Exception { System.out.println("testCorrectSyntax()"); List<String> value = new ArrayList<>(); value.add("08:50"); attributeToCheck.setValue(value); classInstance.checkAttributeSyntax(sess, group, attributeToCheck); }