public void testSetObject_int_Object_int() throws SQLException {
  PreparedStatement ps=null;
  try {
    String query="insert into type (IntVal) values (?);";
    ps=conn.prepareStatement(query);
    Statement st=null;
    try {
      ps.setObject(1,Integer.MAX_VALUE,Types.INTEGER);
      ps.execute();
      st=conn.createStatement();
      st.execute("select * from type where IntVal=" + Integer.MAX_VALUE);
      ResultSet rs=st.getResultSet();
      assertEquals(1,getCount(rs));
    }
  finally {
      try {
        st.close();
      }
 catch (      Exception ee) {
      }
    }
    query="insert into type (LongVal) values (?);";
    ps=conn.prepareStatement(query);
    try {
      ps.setObject(1,"test text",Types.CHAR);
      ps.execute();
      st=conn.createStatement();
      st.execute("select * from type where LongVal='test text';");
      ResultSet rs=st.getResultSet();
      assertEquals(1,getCount(rs));
    }
  finally {
      try {
        st.close();
      }
 catch (      Exception ee) {
      }
    }
    query="insert into type (DecVal) values (?);";
    ps=conn.prepareStatement(query);
    ps.setObject(1,new Object(),Types.DECIMAL);
    ps.execute();
    query="insert into type (dateVal) values (?);";
    ps=conn.prepareStatement(query);
    Date d=new Date(123456789);
    try {
      ps.setObject(1,d,Types.DATE);
      ps.execute();
      st=conn.createStatement();
      st.execute("select * from type where dateVal='" + d.getTime() + "';");
      ResultSet rs=st.getResultSet();
      assertEquals(1,getCount(rs));
    }
  finally {
      try {
        st.close();
      }
 catch (      Exception ee) {
      }
    }
    query="insert into type (BlobVal) values (?);";
    ps=conn.prepareStatement(query);
    try {
      ps.setObject(1,"",Types.BLOB);
      ps.execute();
    }
  finally {
      try {
        st.close();
      }
 catch (      Exception ee) {
      }
    }
  }
  finally {
    try {
      ps.close();
    }
 catch (    Exception ee) {
    }
  }
  try {
    ps.setObject(1,Integer.MAX_VALUE,Types.INTEGER);
    fail("Exception not thrown");
  }
 catch (  SQLException e) {
  }
}

public void testSetObject_int_Object_int ( ) throws SQLException { PreparedStatement ps = null ; try { String query = "insert into type (IntVal) values (?);" ; ps = conn . prepareStatement ( query ) ; Statement st = null ; try { ps . setObject ( 1 , Integer . MAX_VALUE , Types . INTEGER ) ; ps . execute ( ) ; st = conn . createStatement ( ) ; st . execute ( "select * from type where IntVal=" + Integer . MAX_VALUE ) ; ResultSet rs = st . getResultSet ( ) ; assertEquals ( 1 , getCount ( rs ) ) ; } finally { try { st . close ( ) ; } catch ( Exception ee ) { } } query = "insert into type (LongVal) values (?);" ; ps = conn . prepareStatement ( query ) ; try { ps . setObject ( 1 , "test text" , Types . CHAR ) ; ps . execute ( ) ; st = conn . createStatement ( ) ; st . execute ( "select * from type where LongVal='test text';" ) ; ResultSet rs = st . getResultSet ( ) ; assertEquals ( 1 , getCount ( rs ) ) ; } finally { try { st . close ( ) ; } catch ( Exception ee ) { } } query = "insert into type (DecVal) values (?);" ; ps = conn . prepareStatement ( query ) ; ps . setObject ( 1 , new Object ( ) , Types . DECIMAL ) ; ps . execute ( ) ; query = "insert into type (dateVal) values (?);" ; ps = conn . prepareStatement ( query ) ; Date d = new Date ( 123456789 ) ; try { ps . setObject ( 1 , d , Types . DATE ) ; ps . execute ( ) ; st = conn . createStatement ( ) ; st . execute ( "select * from type where dateVal='" + d . getTime ( ) + "';" ) ; ResultSet rs = st . getResultSet ( ) ; assertEquals ( 1 , getCount ( rs ) ) ; } finally { try { st . close ( ) ; } catch ( Exception ee ) { } } query = "insert into type (BlobVal) values (?);" ; ps = conn . prepareStatement ( query ) ; try { ps . setObject ( 1 , "" , Types . BLOB ) ; ps . execute ( ) ; } finally { try { st . close ( ) ; } catch ( Exception ee ) { } } } finally { try { ps . close ( ) ; } catch ( Exception ee ) { } } try { ps . setObject ( 1 , Integer . MAX_VALUE , Types . INTEGER ) ; fail ( "Exception not thrown" ) ; } catch ( SQLException e ) { } }
this test doesn ' t pass on ri
