urn_perun_entityless_attribute_def_def_namespace_uid_policy extends EntitylessAttributesModuleAbstract implements EntitylessAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl perunSession, String key, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) return; if(!(RECYCLE_POLICY.equals(attribute.getValue()) || INCREMENT_POLICY.equals(attribute.getValue()))) throw new WrongAttributeValueException(attribute, key, "Posible values for this attribute are " + RECYCLE_POLICY + " or " + INCREMENT_POLICY); }  @Override void checkAttributeSyntax(PerunSessionImpl perunSession, String key, Attribute attribute); @Override AttributeDefinition getAttributeDefinition(); static final String RECYCLE_POLICY; static final String INCREMENT_POLICY; }
@Test(expected = WrongAttributeValueException.class) public void testWrongValue() throws Exception { System.out.println("testWrongValue()"); attributeToCheck.setValue("wrong value"); classInstance.checkAttributeSyntax(session, "key", attributeToCheck); }
@Test public void testCorrectSyntax() throws Exception { System.out.println("testValueLesserThan1()"); attributeToCheck.setValue("recycle"); classInstance.checkAttributeSyntax(session, "key", attributeToCheck); attributeToCheck.setValue("increment"); classInstance.checkAttributeSyntax(session, "key", attributeToCheck); }