1 19 20 package org.netbeans.modules.db.sql.execute; 21 22 import java.lang.reflect.Field ; 23 import java.lang.reflect.Modifier ; 24 import java.sql.Types ; 25 import org.netbeans.junit.NbTestCase; 26 27 31 public class ResultSetTableModelSupportTest extends NbTestCase { 32 33 public ResultSetTableModelSupportTest(String testName) { 34 super(testName); 35 } 36 37 41 public void testAllTypes() throws IllegalAccessException { 42 Class clazz = Types .class; 43 Field [] fields = clazz.getFields(); 44 for (int i = 0; i < fields.length; i++) { 45 Field field = fields[i]; 46 if (field.getType() == int.class && Modifier.isStatic(field.getModifiers())) { 47 int type = field.getInt(clazz); 48 if (ResultSetTableModelSupport.TYPE_TO_DEF.get(new Integer (type)) == null) { 49 fail("No ColumnTypeDef for java.Types." + field.getName()); 50 } 51 } 52 } 53 } 54 55 59 public void testUnknownTypesIssue71040() throws IllegalAccessException { 60 int type = Integer.MAX_VALUE; 63 Class clazz = Types .class; 64 Field [] fields = clazz.getFields(); 65 for (int i = 0; i < fields.length; i++) { 66 Field field = fields[i]; 67 if (field.getType() == int.class && Modifier.isStatic(field.getModifiers())) { 68 if (type == field.getInt(clazz)) { 69 fail("Type " + type + " already defined in java.sql.Types as " + field.getName()); 70 } 71 } 72 } 73 assertNotNull(ResultSetTableModelSupport.getColumnTypeDef(type)); 74 } 75 } 76 | Popular Tags |