@Test(expected = IllegalArgumentException.class) public void testConfigureGeneratedIdNotInteger() throws Exception { Field field = Foo.class.getField("stringField"); PropertyConfig propertyConfig = Instances.getFieldTypeCreator().createFieldType(connectionSource, "foo", field, Foo.class); OurSqliteDatabaseType dbType = new OurSqliteDatabaseType(); StringBuilder sb = new StringBuilder(); dbType.configureGeneratedId( null, sb, propertyConfig, new ArrayList<String>(), null, new ArrayList<String>(), new ArrayList<String>()); }
@Test public void testConfigureGeneratedIdInteger() throws Exception { Field field = Foo.class.getField("val"); PropertyConfig propertyConfig = Instances.getFieldTypeCreator().createFieldType(connectionSource, "foo", field, Foo.class); OurSqliteDatabaseType dbType = new OurSqliteDatabaseType(); StringBuilder sb = new StringBuilder(); dbType.configureGeneratedId( null, sb, propertyConfig, new ArrayList<String>(), null, new ArrayList<String>(), new ArrayList<String>()); assertTrue(sb.toString().contains("PRIMARY KEY AUTOINCREMENT")); }