Beispiel #1
0
 /** @throws Exception */
 public void testNext() throws Exception {
   MockResultSet rs = new MockResultSet();
   ArrayMap rowData = new ArrayMap();
   Integer value = new Integer(1);
   rowData.put("id", value);
   rs.addRowData(rowData);
   assertTrue(rs.next());
   assertEquals(1, rs.getRow());
   assertFalse(rs.next());
   assertEquals(2, rs.getRow());
   assertFalse(rs.next());
   assertEquals(2, rs.getRow());
 }
Beispiel #2
0
 /** @throws Exception */
 public void testAbsolute() throws Exception {
   MockResultSet rs = new MockResultSet();
   rs.setType(ResultSet.TYPE_SCROLL_INSENSITIVE);
   ArrayMap rowData = new ArrayMap();
   Timestamp value = new Timestamp(0);
   rowData.put("hoge", value);
   rs.addRowData(rowData);
   rs.addRowData(rowData);
   assertTrue(rs.absolute(1));
   assertEquals(1, rs.getRow());
   assertTrue(rs.absolute(2));
   assertEquals(2, rs.getRow());
   assertFalse(rs.absolute(0));
   assertEquals(2, rs.getRow());
   assertFalse(rs.absolute(3));
   assertEquals(2, rs.getRow());
 }
Beispiel #3
0
 /** @throws Exception */
 public void testPrevious() throws Exception {
   MockResultSet rs = new MockResultSet();
   try {
     rs.previous();
     fail();
   } catch (SQLException e) {
     System.out.println(e);
   }
   rs.setType(ResultSet.TYPE_SCROLL_INSENSITIVE);
   ArrayMap rowData = new ArrayMap();
   Integer value = new Integer(1);
   rowData.put("id", value);
   rs.addRowData(rowData);
   assertTrue(rs.next());
   assertFalse(rs.next());
   assertTrue(rs.previous());
   assertEquals(1, rs.getRow());
   assertFalse(rs.previous());
   assertEquals(0, rs.getRow());
 }