@Override
  protected int command() {
    if (!validateConfigFilePresent()) {
      return 1;
    }

    final MigrationConfig config;
    try {
      config = MigrationConfig.load(getConfigFile());
    } catch (KsqlException | MigrationException e) {
      LOGGER.error(e.getMessage());
      return 1;
    }

    return command(
            config,
            MigrationsUtil::getKsqlClient,
            getMigrationsDir(getConfigFile(), config),
            Clock.systemDefaultZone()
    );
  }
@Test
  public void defineStatementsShouldTakePrecedenceOverArgumentVariables() throws Exception {
    // Given:
    command = PARSER.parse("-a", "-d", "name=tame");
    createMigrationFile(1, NAME, migrationsDir, "DEFINE name='flame'; INSERT INTO FOO VALUES ('${name}');");
    when(versionQueryResult.get()).thenReturn(ImmutableList.of());
    when(ksqlClient.getVariables()).thenReturn(
        ImmutableMap.of("name", "flame")
    );
    givenAppliedMigration(1, NAME, MigrationState.MIGRATED);

    // When:
    final int result = command.command(config, (cfg, headers) -> ksqlClient, migrationsDir, Clock.fixed(
        Instant.ofEpochMilli(1000), ZoneId.systemDefault()));

    // Then:
    assertThat(result, is(0));
    final InOrder inOrder = inOrder(ksqlClient);
    inOrder.verify(ksqlClient).define("name", "flame");
    inOrder.verify(ksqlClient).insertInto("`FOO`", new KsqlObject(ImmutableMap.of("`A`", "flame")));
    inOrder.verify(ksqlClient).close();
    inOrder.verifyNoMoreInteractions();
  }