コード例 #1
0
 @Test
 public void testOtherDatabaseNames() throws SQLException {
   mockConnection.setEmptyResults();
   new Connection(mockConnection, "foobar").createStatement().executeQuery(SELECT);
   assertTrue(mockConnection.lastRequest.hasDatabaseName());
   assertEquals("foobar", mockConnection.lastRequest.getDatabaseName());
 }
コード例 #2
0
  @Test
  public void testClientIds() throws SQLException {
    mockConnection.setEmptyResults();
    connection.createStatement().executeQuery(SELECT);
    int id1 = mockConnection.lastRequest.getTransactionId();

    new Connection(mockConnection, "test").createStatement().executeQuery(SELECT);
    int id2 = mockConnection.lastRequest.getTransactionId();
    assertTrue(id1 != id2);
  }