### Question:
TableDescFactoryImpl implements TableDescFactory { public TableDesc getTableDesc(EntityMeta entityMeta) { String fullName = entityMeta.getTableMeta().getFullName().toLowerCase(); TableDesc tableDesc = tableDescMap.get(fullName); if (tableDesc != null) { return tableDesc; } tableDesc = createTableDesc(entityMeta); tableDescMap.put(fullName, tableDesc); return tableDesc; } TableDescFactoryImpl(GenDialect dialect,
            ColumnDescFactory columnDescFactory,
            PrimaryKeyDescFactory primaryKeyDescFactory,
            UniqueKeyDescFactory uniqueKeyDescFactory,
            ForeignKeyDescFactory foreignKeyDescFactory,
            SequenceDescFactory sequenceDescFactory,
            IdTableDescFactory idTableDescFactory); TableDesc getTableDesc(EntityMeta entityMeta);  }### Answer:
@Test public void testGetTableDesc() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Aaa.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); assertNotNull(tableDesc); assertSame(tableDesc, tableDescFactory.getTableDesc(entityMeta)); }
@Test public void testName() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Aaa.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); assertEquals("hoge", tableDesc.getCatalogName()); assertEquals("foo", tableDesc.getSchemaName()); assertEquals("AAA", tableDesc.getName()); }
@Test public void testColumnDescList() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Aaa.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); assertEquals(2, tableDesc.getColumnDescList().size()); }
@Test public void testColumnDescList_multiClass() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Ggg.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); List<ColumnDesc> list = tableDesc.getColumnDescList(); assertEquals(6, list.size()); assertEquals("ID1", list.get(0).getName()); assertEquals("ID2", list.get(1).getName()); assertEquals("ID3", list.get(2).getName()); assertEquals("NAME3", list.get(3).getName()); assertEquals("NAME2", list.get(4).getName()); assertEquals("NAME1", list.get(5).getName()); }
@Test public void testPrimaryKeyDescList() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Aaa.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); assertNotNull(tableDesc.getPrimaryKeyDesc()); }
@Test public void testForeignKeyDescList() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Aaa.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); assertEquals(1, tableDesc.getForeignKeyDescList().size()); }
@Test public void testUniqueKeyDescList_uniqueConstraints() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Aaa.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); assertEquals(1, tableDesc.getUniqueKeyDescList().size()); }
@Test public void testUniqueKeyDescList_unique() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Ddd.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); assertEquals(1, tableDesc.getUniqueKeyDescList().size()); }
@Test public void testSequenceDescList() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Aaa.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); assertEquals(1, tableDesc.getSequenceDescList().size()); }
@Test public void testIdTableDescList() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Ccc.class); TableDesc tableDesc = tableDescFactory.getTableDesc(entityMeta); assertEquals(1, tableDesc.getIdTableDescList().size()); }