### Question:
SchemaProducerImpl implements SchemaProducer { @VisibleForTesting String loadDaoScripts(Set<Table> tables, Version version) { StringBuilder schema = new StringBuilder(); for (Table table : tables) { String script = loadTableScript(table, version); if (!Strings.isNullOrEmpty(script)) { schema.append(script) .append(LINE_BREAK); } } return schema.toString(); } @Inject @VisibleForTesting  SchemaProducerImpl(DaoTables tablesOfDao); @Override SortedSet<Version> versionsAvailable(); @Override String lastSchema(); @Override String schema(Version version); @Override String lastSchemaForDAO(Class<? extends CassandraDao> clazz); @Override String schemaForDAO(Class<? extends CassandraDao> clazz, final Version version); @Override String schema(Version fromVersion, Version toVersion);  }### Answer:
@Test public void testLoadDaoScriptsNoScript() { String scripts = schemaProducerImpl.loadDaoScripts(ImmutableSet.of(Table.of("unknown")), Version.of(1)); assertThat(scripts).isEmpty(); }
@Test public void testLoadDaoScriptsVersion1() { String scripts = schemaProducerImpl.loadDaoScripts(ImmutableSet.of(Table.of("monitored_collection")), Version.of(1)); assertThat(scripts).isEqualTo( "CREATE TABLE monitored_collection (\n" + " credentials text,\n" + " device text,\n" + " analysed_sync_collections set<text>,\n" + " PRIMARY KEY (credentials, device)\n" + ");\n"); }
@Test public void testLoadDaoScriptsVersion2() { String scripts = schemaProducerImpl.loadDaoScripts(ImmutableSet.of(Table.of("monitored_collection")), Version.of(2)); assertThat(scripts).isEqualTo( "ALTER TABLE monitored_collection VERSION 2\n"); }
@Test public void testLoadDaoScriptsVersion1WithTablesFromDao() { String scripts = schemaProducerImpl.loadDaoScripts( TABLES_OF_DAO.getTables(MonitoredCollectionDaoCassandraImpl.class), Version.of(1)); assertThat(scripts).isEqualTo( "CREATE TABLE monitored_collection (\n" + " credentials text,\n" + " device text,\n" + " analysed_sync_collections set<text>,\n" + " PRIMARY KEY (credentials, device)\n" + ");\n"); }
@Test public void testLoadDaoScriptsVersion2WithTablesFromDao() { String scripts = schemaProducerImpl.loadDaoScripts( TABLES_OF_DAO.getTables(MonitoredCollectionDaoCassandraImpl.class), Version.of(2)); assertThat(scripts).isEqualTo( "ALTER TABLE monitored_collection VERSION 2\n"); }