@org.junit.Test
  public void testFromRoleFound() {
    LReceiveValidationRule rule = new LReceiveValidationRule();
    TestValidationLogger logger = new TestValidationLogger();

    Module module = new Module();
    module.setName("test");

    LProtocolDefinition lpd = new LProtocolDefinition();

    RoleDecl rd = new RoleDecl();
    rd.setName(TEST_ROLE1);
    lpd.getRoleDeclarations().add(rd);

    module.getProtocols().add(lpd);

    LBlock block = new LBlock();
    lpd.setBlock(block);

    LReceive recv = new LReceive();
    recv.setFromRole(new Role(TEST_ROLE1));
    block.add(recv);

    Message message = new Message();
    recv.setMessage(message);

    rule.validate(null, recv, logger);

    if (logger.isErrorsOrWarnings()) {
      fail("Errors detected");
    }
  }
  /** {@inheritDoc} */
  public Object createModelObject(ParserContext context) {
    java.util.List<RoleDecl> ret = new java.util.ArrayList<RoleDecl>();
    boolean f_iterate = false;

    // consume ')'
    context.pop();

    do {
      f_iterate = false;

      RoleDecl rd = new RoleDecl();

      setEndProperties(rd, context.peek());

      rd.setName(((CommonToken) context.pop()).getText());

      if (context.peek() instanceof CommonToken
          && ((CommonToken) context.peek()).getText().equals("as")) {
        context.pop(); // 'as'

        rd.setAlias(rd.getName());

        rd.setName(((CommonToken) context.pop()).getText());
      }

      setStartProperties(rd, context.pop()); // role

      ret.add(0, rd);

      if (context.peek() instanceof CommonToken
          && ((CommonToken) context.peek()).getText().equals(",")) {
        context.pop(); // ,
        f_iterate = true;
      }
    } while (f_iterate);

    // consume '('
    context.pop();

    context.push(ret);

    return ret;
  }