コード例 #1
0
 @Test
 public void testDelete() {
   TextbookManager tm = new TextbookManager();
   int lastInsertedId = tm.getLastInsertedId();
   int rowsAffected = tm.delete(lastInsertedId);
   assertEquals(1, rowsAffected);
 }
コード例 #2
0
  @Test
  public void testSave() {

    Textbook book = new Textbook("test", "test", "test", "test", "test", "test", "test");
    TextbookManager tm = new TextbookManager();
    int rowsAffected = tm.save(book);
    assertEquals(1, rowsAffected);
  }
コード例 #3
0
  @Test
  public void testSelect() {
    TextbookManager tm = new TextbookManager();
    int lastInsertedId = tm.getLastInsertedId();
    ResultSet result = tm.select(lastInsertedId);

    try {
      result.first();
      assertEquals(1, result.getRow());
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }