  @Test
  public void execute_command() {

    SonarRunner build = SonarRunner.create()
      .setProjectDir(new File("."))
      .setProjectKey("SAMPLE")
      .setTimeoutSeconds(30)
      .setDebugLogs(true)
      .setRunnerVersion("1.3");
    Map<String, String> props = new TreeMap<>();
    props.put("sonar.jdbc.dialect", "h2");
    props.put("sonar.projectKey", "SAMPLE");

    SonarScannerInstaller installer = mock(SonarScannerInstaller.class);
    when(installer.install(eq(Version.create("1.3")), eq(null), any(File.class), eq(true))).thenReturn(new File("sonar-runner.sh"));
    CommandExecutor executor = mock(CommandExecutor.class);
    when(executor.execute(any(Command.class), any(StreamConsumer.class), anyLong())).thenReturn(2);

    new SonarScannerExecutor().execute(build, Configuration.create(), props, installer, executor);

    verify(executor).execute(argThat(c -> c.getDirectory().equals(new File("."))
      && c.toCommandLine().contains("sonar-runner")
      && c.toCommandLine().contains("-X")
      && c.toCommandLine().contains("-Dsonar.jdbc.dialect")
      && c.toCommandLine().contains("-Dsonar.projectKey")), any(), eq(30000L));
  }