public void testInvalidCharactersInOption() { Function x = new Function(); x.setModuleId("MOD"); x.setBaseLanguage("GB"); x.setId("D?D"); Message message = validateForOneMessage(x); Object actual = message == null ? null : message.getText(); assertEquals(LanguageResources.getString("Language.InvalidCharactersInOption"), actual); // Space x.setId("D D"); message = validateForOneMessage(x); actual = message == null ? null : message.getText(); assertEquals(LanguageResources.getString("Language.InvalidCharactersInOption"), actual); // Lower case x.setId("d D"); message = validateForOneMessage(x); actual = message == null ? null : message.getText(); assertEquals(LanguageResources.getString("Language.InvalidCharactersInOption"), actual); // Asterisk x.setId("* D"); message = validateForOneMessage(x); actual = message == null ? null : message.getText(); assertEquals(LanguageResources.getString("Language.InvalidCharactersInOption"), actual); }
public void testFunctionBlankOption() { Function x = new Function(); x.setModuleId("MOD"); x.setBaseLanguage("GB"); Message message = validateForOneMessage(x); Object actual = message == null ? null : message.getText(); assertEquals(LanguageResources.getString("Language.OptionMustBeSpecified"), actual); }
public void testMultipleMessages() { Function x = new Function(); x.setModuleId("MOD"); x.setBaseLanguage("GB"); x.setId("DDD"); MessageContainer messageContainer = new MessageContainer(); x.validateBean(messageContainer, null, true); assertEquals(2, messageContainer.getMessageCount()); }
/** * Creates and returns a valid Function object * * @return A valid Function object * @throws EQException */ private Function getValidFunction() throws EQException { Function function = new Function(); function.setModuleId("MOD"); function.setBaseLanguage("GB"); function.setId("DDD"); function.setLabel("DDD label"); function.setDescription("DDD description"); InputFieldSet primary = new InputFieldSet(Function.PRIMARY_ID, Function.PRIMARY_ID, Function.PRIMARY_ID); InputField field1 = new InputField("FIELD1", "Field 1", "Field 1 Description"); field1.setDataType(EqDataType.TYPE_CHAR); field1.setSize("10"); primary.addInputField(field1); function.addInputFieldSet(primary); return function; }