urn_perun_user_attribute_def_def_preferredShells extends UserAttributesModuleAbstract implements UserAttributesModuleImplApi { @Override public void checkAttributeSyntax(PerunSessionImpl sess, User user, Attribute attribute) throws WrongAttributeValueException { if (attribute.getValue() == null) return; List<String> pshell = attribute.valueAsList(); for (String shell : pshell) { if (shell == null) throw new WrongAttributeValueException(attribute, user, "shell cannot be empty string"); sess.getPerunBl().getModulesUtilsBl().checkFormatOfShell(shell, attribute); } }  @Override void checkAttributeSyntax(PerunSessionImpl sess, User user, Attribute attribute); @Override AttributeDefinition getAttributeDefinition();  }
@Test public void testCheckAttributeSyntax() throws Exception { System.out.println("testCheckAttributeSyntax()"); List<String> value = new ArrayList<>(); value.add("example"); attributeToCheck.setValue(value); classInstance.checkAttributeSyntax(session, user, attributeToCheck); }
@Test(expected = WrongAttributeValueException.class) public void testCheckAttributeSyntaxWithWrongValue() throws Exception { System.out.println("testCheckAttributeSyntaxWithWrongValue()"); List<String> value = new ArrayList<>(); value.add(null); attributeToCheck.setValue(value); classInstance.checkAttributeSyntax(session, user, attributeToCheck); }