public void testNamedEnumEntity() { EntityCache cache = new EntityCache(EnumEntity.class, "enum_entity", null); cache.setPk( new PrimaryKeyProperty( "id", Reflactor.in(EnumEntity.class).returnField("id"), null, null, false)); cache.add( new EnumeratedProperty( "type", Reflactor.in(EnumEntity.class).returnField("type"), null, null, EnumType.Name)); this.cache.add(cache); final String expected = "CREATE TABLE enum_entity ( id INTEGER PRIMARY KEY NOT NULL, type TEXT );"; String returned = builder.build(EnumEntity.class); assertEquals(expected, returned); }
public void testSimpleEntity() { EntityCache cache = new EntityCache(People.class, "people", null); cache.setPk( new PrimaryKeyProperty( "id", Reflactor.in(People.class).returnField("id"), null, null, false)); cache.add(new Property("name", Reflactor.in(People.class).returnField("name"), null, null)); cache.add( new Property("address", Reflactor.in(People.class).returnField("address"), null, null)); cache.add(new Property("phone", Reflactor.in(People.class).returnField("phone"), null, null)); this.cache.add(cache); final String expected = "CREATE TABLE people ( id INTEGER PRIMARY KEY NOT NULL, address TEXT, name TEXT, phone TEXT );"; String returned = builder.build(People.class); assertEquals(expected, returned); }