示例#1
0
  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);
  }
示例#2
0
 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);
 }
示例#3
0
  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());
  }
示例#4
0
 /**
  * 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;
 }