### Question:
CqlFilesMigrationService implements SchemaInstaller, MigrationService { @Override public void install(Version latestVersionUpdate) { String schema = schemaProducer.schema(latestVersionUpdate); if (Strings.isNullOrEmpty(schema)) { throw new InstallSchemaNotFoundException(); } executeCQL(schema); } @Inject @VisibleForTesting  CqlFilesMigrationService(
			@Named(LoggerModule.MIGRATION) Logger logger,
			SchemaProducer schemaProducer,
			Provider<Session> sessionProvider); @Override void install(Version latestVersionUpdate); @Override void migrate(Version currentVersion, Version toVersion);  }### Answer:
@Test public void install() { String schema = "schema"; Version version = Version.of(1); expect(schemaProducer.schema(version)).andReturn(schema); expect(session.execute(schema)).andReturn(null); logger.debug("CQL: {}", schema); expectLastCall(); mocks.replay(); testee.install(version); mocks.verify(); }
@Test(expected=InvalidQueryException.class) public void installInvalidScript() { String schema = "schema"; Version version = Version.of(1); expect(schemaProducer.schema(version)).andReturn(schema); expect(session.execute(schema)).andThrow(new InvalidQueryException("expected message")); logger.debug("CQL: {}", schema); expectLastCall(); mocks.replay(); try { testee.install(version); } catch (Exception e) { mocks.verify(); throw e; } }
@Test(expected=NoHostAvailableException.class) public void installNoHostAvailable() { String schema = "schema"; Version version = Version.of(1); expect(schemaProducer.schema(version)).andReturn(schema); expect(session.execute(schema)).andThrow(new NoHostAvailableException(ImmutableMap.<InetSocketAddress, Throwable> of())); logger.debug("CQL: {}", schema); expectLastCall(); mocks.replay(); try { testee.install(version); } catch (Exception e) { mocks.verify(); throw e; } }
@Test(expected=InstallSchemaNotFoundException.class) public void installNoInitilizationSchema() { Version version = Version.of(1); expect(schemaProducer.schema(version)).andReturn(null); mocks.replay(); try { testee.install(version); } catch (Exception e) { mocks.verify(); throw e; } }