@Test
  public void testSelectWithFromWithLock() {
    Visitor queryVis = getVisitor();

    Table tab1 = new Table("FOO");
    Table tab2 = new Table("BAR");
    TableAlias tab3 = new TableAlias(new Table("ABC"), "xyz");

    Select sel = new Select(tab1);
    sel.setLocked(true);
    sel.addFrom(tab2);
    sel.addFrom(tab3);

    queryVis.visit(sel);

    assertTrue(sel.hasFrom());

    Iterator<Qualifier> iter = sel.getFrom().iterator();
    assertEquals(iter.next(), tab1);
    assertEquals(iter.next(), tab2);
    assertEquals(iter.next(), tab3);
    assertFalse(iter.hasNext());

    assertEquals(
        "SELECT * " + "FROM \"FOO\" HOLDLOCK, \"BAR\" HOLDLOCK, " + "\"ABC\" \"xyz\" HOLDLOCK",
        queryVis.toString());
  }
  @Test
  public void testSelectWithFromAndJoinsWithLock() {
    Visitor queryVis = getVisitor();

    Table tab1 = new Table("FOO");
    Column col1 = new Column(tab1, "ID");

    Table tab2 = new Table("BAR");
    Column col21 = new Column(tab2, "ID");
    Column col22 = new Column(tab2, "ABC_ID");

    TableAlias tab3 = new TableAlias(new Table("ABC"), "xyz");
    Column col3 = new Column(tab3, "ID");

    Table tab4 = new Table("FN");
    Table tab5 = new Table("ORD");
    TableAlias tab6 = new TableAlias(new Table("FN"), "abc");

    Select sel = new Select(tab1);
    sel.setLocked(true);
    tab1.addInnerJoin(tab2, col1.equal(col21));
    tab2.addLeftJoin(tab3, col22.equal(col3));

    sel.addFrom(tab4);
    sel.addFrom(tab5);
    tab5.addRightJoin(tab6);

    queryVis.visit(sel);

    assertTrue(sel.hasFrom());

    Iterator<Qualifier> iter = sel.getFrom().iterator();
    assertEquals(iter.next(), tab1);
    assertEquals(iter.next(), tab4);
    assertEquals(iter.next(), tab5);
    assertFalse(iter.hasNext());

    assertEquals(
        "SELECT * "
            + "FROM (\"FOO\" HOLDLOCK "
            + "INNER JOIN (\"BAR\" HOLDLOCK "
            + "LEFT JOIN \"ABC\" \"xyz\" HOLDLOCK "
            + "ON \"BAR\".\"ABC_ID\"=\"xyz\".\"ID\") "
            + "ON \"FOO\".\"ID\"=\"BAR\".\"ID\")"
            + ", \"FN\" HOLDLOCK, (\"ORD\" HOLDLOCK RIGHT JOIN \"FN\" \"abc\" "
            + "HOLDLOCK)",
        queryVis.toString());
  }