/** @tests {@link javax.sql.rowset.serial.SQLInputImpl#readArray()} */
  public void testReadArray() throws SQLException {
    Array array = new MockArray();
    Object[] attributes = new Object[] {array};
    SQLInputImpl impl = new SQLInputImpl(attributes, new HashMap<String, Class<?>>());
    assertEquals(array, impl.readArray());

    try {
      impl.readArray();
      fail("should throw SQLException");
    } catch (SQLException e) {
      // expected
    }

    attributes = new Object[] {null};
    impl = new SQLInputImpl(attributes, new HashMap<String, Class<?>>());
    assertNull(impl.readArray());
  }
Esempio n. 2
0
 /*
  * Validate a Array can be read
  */
 @Test(enabled = true)
 public void test06() throws Exception {
   Object[] coffees = new Object[] {"Espresso", "Colombian", "French Roast", "Cappuccino"};
   Array a = new StubArray("VARCHAR", coffees);
   Object[] values = {a};
   SQLInputImpl sqli = new SQLInputImpl(values, map);
   Array a2 = sqli.readArray();
   assertTrue(Arrays.equals((Object[]) a2.getArray(), (Object[]) a.getArray()));
   assertTrue(a.getBaseTypeName().equals(a2.getBaseTypeName()));
 }