/**
   * @throws Exception
   * @tests java.sql.rowset.joinRowSet#getWhereClause()
   */
  public void testGetWhereClause_SingleJdbcRowSet() throws Exception {
    String whereClause;

    // Creates jdbc rowset.
    JdbcRowSet jdbcRs;
    jdbcRs = newJdbcRowSet();
    jdbcRs.setCommand("SELECT * FROM USER_INFO");
    jdbcRs.setUrl(DERBY_URL);
    jdbcRs.execute();

    jdbcRs.setMatchColumn("ID");
    jrs.addRowSet(jdbcRs);

    if (System.getProperty("Testing Harmony") == "true") {
      whereClause = jrs.getWhereClause();
      assertNotNull(whereClause);
    } else {
      try {
        whereClause = jrs.getWhereClause();
        fail("Should throw NullPointerException.");
      } catch (NullPointerException e) {
        // Expected.
      }
    }

    CachedRowSet rowSetInJrs = (CachedRowSet) jrs.getRowSets().iterator().next();
    rowSetInJrs.setTableName("Table1");

    whereClause = jrs.getWhereClause();
    assertNotNull(whereClause);
  }
  /**
   * @throws Exception
   * @tests java.sql.rowset.joinRowSet#getWhereClause()
   */
  public void testGetWhereClause_MultipleCachedRowSet() throws Exception {
    String whereClause;

    // Creates another cached rowset.
    CachedRowSet crset2;
    crset2 = newNoInitialInstance();
    crset2.setCommand("SELECT * FROM BOOKS");
    crset2.setUrl(DERBY_URL);
    crset2.execute();

    // Tests when there are on jdbcRowSet and one CachedRowSet.
    jrs.addRowSet(crset2, 1);
    jrs.addRowSet(crset, 1);

    if (System.getProperty("Testing Harmony") == "true") {
      whereClause = jrs.getWhereClause();
      assertNotNull(whereClause);
    } else {
      try {
        whereClause = jrs.getWhereClause();
        fail("Should throw NullPointerException.");
      } catch (NullPointerException e) {
        // Expected.
      }
    }
    crset.setTableName("Table1");
    crset2.setTableName("Table2");
    if (System.getProperty("Testing Harmony") == "true") {
      whereClause = jrs.getWhereClause();
      assertNotNull(whereClause);
    } else {
      try {
        whereClause = jrs.getWhereClause();
        fail("Should throw SQLException.");
      } catch (SQLException e) {
        // Expected.
      }
    }

    crset.setMatchColumn("ID");
    crset2.setMatchColumn("AUTHORID");
    whereClause = jrs.getWhereClause();
    assertNotNull(whereClause);

    jrs = newJoinRowSet();
    jrs.addRowSet(crset2, "AUTHORID");
    jrs.addRowSet(crset, "ID");
    whereClause = jrs.getWhereClause();
    assertNotNull(whereClause);

    crset2.close();
  }
  /**
   * @throws Exception
   * @tests java.sql.rowset.joinRowSet#getWhereClause()
   */
  public void testGetWhereClause_MoreRowSets() throws Exception {
    crset.setTableName("Table1");
    jrs.addRowSet(crset, "ID");

    // Creates another cached rowset.
    CachedRowSet crset2;
    crset2 = newNoInitialInstance();
    crset2.setCommand("SELECT * FROM BOOKS");
    crset2.setUrl(DERBY_URL);
    crset2.execute();
    crset2.setTableName("Table2");
    jrs.addRowSet(crset2, "AUTHORID");

    crset2 = newNoInitialInstance();
    crset2.setCommand("SELECT * FROM BOOKS");
    crset2.setUrl(DERBY_URL);
    crset2.execute();
    crset2.setTableName("Table3");
    jrs.addRowSet(crset2, "AUTHORID");

    String whereClause = jrs.getWhereClause();
    assertNotNull(whereClause);
  }