Esempio n. 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);
  }
Esempio n. 2
0
 public void testValidFunction() throws EQException {
   Function x = getValidFunction();
   Message message = validateForOneMessage(x);
   if (message != null) {
     assertEquals(null, message.getText());
   }
 }
Esempio n. 3
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);
 }
Esempio n. 4
0
  public void testValidShortOption() throws EQException {
    Function x = getValidFunction();
    x.setId("D"); // A short option

    Message message = validateForOneMessage(x);
    Object actual = message == null ? null : message.getText();
    assertEquals(null, actual);
  }
Esempio n. 5
0
  /**
   * Ensure that a title longer than 35 characters results in the expected error message
   *
   * @throws EQException
   */
  public void testTitleTooLong() throws EQException {
    Function x = getValidFunction();
    x.setLabel("123456789012345678901234567890123456");

    Message message = validateForOneMessage(x);

    Object actual = message == null ? null : message.getText();
    assertEquals(
        LanguageResources.getString("Language.ServiceTitleCannotBeLongerThan35Characters"), actual);
  }
Esempio n. 6
0
  /** Ensure that a blank title results in the expected error message */
  public void testFunctionBlankTitle() {
    Function x = new Function();
    x.setModuleId("MOD");
    x.setId("DDD");

    Message message = validateForOneMessage(x);

    Object actual = message == null ? null : message.getText();
    assertEquals(LanguageResources.getString("Language.ServiceTitleMustBeEntered"), actual);
  }
Esempio n. 7
0
  public void testBaseLanguageMustBeEntered() {
    Function x = new Function();
    x.setModuleId("MOD");
    x.setId("DDD");
    x.setLabel("DDD label");
    x.setDescription("DDD description");

    Message message = validateForOneMessage(x);
    Object actual = message == null ? null : message.getText();
    assertEquals(LanguageResources.getString("Language.BaseLanguageMustBeEntered"), actual);
  }
Esempio n. 8
0
  public void testOptionTooLong() {
    Function x = new Function();
    x.setModuleId("MOD");
    x.setId("DDDD");

    Message message = validateForOneMessage(x);

    assertNotNull(message);
    assertEquals(
        LanguageResources.getString("Language.OptionCannotBeLongerThan3Characters"),
        message.getText());
  }
Esempio n. 9
0
  /** Test error when the module id is not 3 characters: */
  public void testModuleId() {
    Function x = new Function();
    x.setId("DDD");
    x.setLabel("DDD label");
    x.setDescription("DDD description");

    // If blank
    Message message = validateForOneMessage(x);
    Object actual = message == null ? null : message.getText();
    assertEquals(
        LanguageResources.getFormattedString(
            "Langugae.ModuleIdMustBeThreeCharacters", x.getModuleId()),
        actual);

    // 2 chars:
    x.setModuleId("MO");
    message = validateForOneMessage(x);
    actual = message == null ? null : message.getText();
    assertEquals(
        LanguageResources.getFormattedString(
            "Langugae.ModuleIdMustBeThreeCharacters", x.getModuleId()),
        actual);
  }