Example #1
0
  /**
   * Test method.
   *
   * @throws AgiException if command is malformed.
   */
  public void testCommand() throws AgiException {
    String text = "abc";
    String escapeDigits;

    // Testing first constructor
    StringBuilder b = new StringBuilder("SAY ALPHA");
    b.append(" ");
    b.append("\"");
    b.append(text);
    b.append("\"");
    b.append(" ");
    b.append("\"");
    b.append("\"");

    SayAlpha command = new SayAlpha(text);
    assertEquals(b.toString(), CommandProcessor.buildCommand(command));

    // Testing second constructor
    escapeDigits = "123";
    b = new StringBuilder("SAY ALPHA");
    b.append(" ");
    b.append("\"");
    b.append(text);
    b.append("\"");
    b.append(" ");
    b.append("\"");
    b.append(escapeDigits);
    b.append("\"");

    command = new SayAlpha(text, escapeDigits);
    assertEquals(b.toString(), CommandProcessor.buildCommand(command));
  }
  /**
   * Test method.
   *
   * @throws AgiException if command is malformed.
   */
  public void testCommand() throws AgiException {
    String extension = "100";
    StringBuilder b = new StringBuilder("SET EXTENSION");
    b.append(" ");
    b.append("\"");
    b.append(extension);
    b.append("\"");

    SetExtension command = new SetExtension(extension);
    assertEquals(b.toString(), CommandProcessor.buildCommand(command));
  }