### Question:
LevelDBTableService implements AutoCloseable { public Map<TableId, TableStats> getTableStats() throws Exception { ensureOpen(); File baseDir = new File(basePath); File[] subDirs = baseDir.listFiles(); if (subDirs == null) { return ImmutableMap.of(); } ImmutableMap.Builder<TableId, TableStats> builder = ImmutableMap.builder(); for (File dir : subDirs) { String tableName = getTableName(dir.getName()); long size = getSize(dir); builder.put(LevelDBNameConverter.from(tableName), new TableStats(size)); } return builder.build(); } @VisibleForTesting  LevelDBTableService(); @VisibleForTesting static LevelDBTableService getInstance(); @Inject void setConfiguration(CConfiguration config); void clearTables(); void close(); Collection<String> list(); Map<TableId, TableStats> getTableStats(); WriteOptions getWriteOptions(); DB getTable(String tableName); void ensureTableExists(String tableName); void dropTable(String name);  }### Answer:
@Test public void testGetTableStats() throws Exception { String table1 = "cdap_default.table1"; String table2 = "cdap_default.table2"; TableId tableId1 = TableId.from("default", "table1"); TableId tableId2 = TableId.from("default", "table2"); Assert.assertNull(service.getTableStats().get(tableId1)); Assert.assertNull(service.getTableStats().get(tableId2)); service.ensureTableExists(table1); service.ensureTableExists(table2); TimeUnit.SECONDS.sleep(1); Assert.assertNotNull(service.getTableStats().get(tableId1)); long table1Size = service.getTableStats().get(tableId1).getDiskSizeBytes(); Assert.assertNotNull(service.getTableStats().get(tableId2)); long table2Size = service.getTableStats().get(tableId2).getDiskSizeBytes(); writeSome(table1); TimeUnit.SECONDS.sleep(1); long table1SizeUpdated = service.getTableStats().get(tableId1).getDiskSizeBytes(); Assert.assertTrue(table1SizeUpdated > table1Size); table1Size = table1SizeUpdated; Assert.assertEquals(table2Size, service.getTableStats().get(tableId2).getDiskSizeBytes()); writeSome(table1); writeSome(table2); TimeUnit.SECONDS.sleep(1); Assert.assertTrue(service.getTableStats().get(tableId1).getDiskSizeBytes() > table1Size); long table2SizeUpdated = service.getTableStats().get(tableId2).getDiskSizeBytes(); Assert.assertTrue(table2SizeUpdated > table2Size); table2Size = table2SizeUpdated; service.dropTable(table1); TimeUnit.SECONDS.sleep(1); Assert.assertNull(service.getTableStats().get(tableId1)); Assert.assertEquals(table2Size, service.getTableStats().get(tableId2).getDiskSizeBytes()); }