1 19 20 package org.netbeans.modules.db.test.jdbcstub; 21 22 import java.sql.DatabaseMetaData ; 23 import java.sql.ResultSet ; 24 import java.sql.Types ; 25 import junit.framework.TestCase; 26 27 31 public class JDBCStubUtilTest extends TestCase { 32 33 public JDBCStubUtilTest(String name) { 34 super(name); 35 } 36 37 public void testColumnsResultSet() throws Exception { 38 ResultSet rs = JDBCStubUtil.columnsResultSet( 39 new String [] { "REAL_COL", "VARCHAR_COL" }, 40 new String [] { "REAL", "VARCHAR" }, 41 new int[] { Types.REAL, Types.VARCHAR }, 42 new int[] { 10, 20 }, 43 new int[] { 6, 0 }, 44 new int[] { DatabaseMetaData.columnNoNulls, DatabaseMetaData.columnNullable } 45 ); 46 47 rs.next(); 48 assertEquals("REAL_COL", rs.getString("COLUMN_NAME")); 49 assertEquals("REAL", rs.getString("TYPE_NAME")); 50 assertEquals(Types.REAL, rs.getInt("DATA_TYPE")); 51 assertEquals(10, rs.getInt("COLUMN_SIZE")); 52 assertEquals(6, rs.getInt("DECIMAL_DIGITS")); 53 assertEquals(DatabaseMetaData.columnNoNulls, rs.getInt("NULLABLE")); 54 55 rs.next(); 56 assertEquals("VARCHAR_COL", rs.getString("COLUMN_NAME")); 57 assertEquals("VARCHAR", rs.getString("TYPE_NAME")); 58 assertEquals(Types.VARCHAR, rs.getInt("DATA_TYPE")); 59 assertEquals(20, rs.getInt("COLUMN_SIZE")); 60 assertEquals(0, rs.getInt("DECIMAL_DIGITS")); 61 assertEquals(DatabaseMetaData.columnNullable, rs.getInt("NULLABLE")); 62 } 63 } 64 | Popular Tags |