/*
 * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
 *
 * THIS SOFTWARE CONTAINS PROPRIETARY AND CONFIDENTIAL INFORMATION OWNED BY PALANTIR TECHNOLOGIES INC.
 * UNAUTHORIZED DISCLOSURE TO ANY THIRD PARTY IS STRICTLY PROHIBITED
 *
 * For good and valuable consideration, the receipt and adequacy of which is acknowledged by Palantir and recipient
 * of this file ("Recipient"), the parties agree as follows:
 *
 * This file is being provided subject to the non-disclosure terms by and between Palantir and the Recipient.
 *
 * Palantir solely shall own and hereby retains all rights, title and interest in and to this software (including,
 * without limitation, all patent, copyright, trademark, trade secret and other intellectual property rights) and
 * all copies, modifications and derivative works thereof.  Recipient shall and hereby does irrevocably transfer and
 * assign to Palantir all right, title and interest it may have in the foregoing to Palantir and Palantir hereby
 * accepts such transfer. In using this software, Recipient acknowledges that no ownership rights are being conveyed
 * to Recipient.  This software shall only be used in conjunction with properly licensed Palantir products or
 * services.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package com.palantir.docker.compose.execution;

import org.junit.Test;

import java.io.IOException;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.Matchers.anyVararg;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class SynchronousDockerComposeExecutableShould {
    private Process executedProcess = mock(Process.class);

    @Test public void
    respond_with_the_process_exit_code() throws IOException {
        givenTheProcessTerminatesWithAnExitCodeOf(1);
        DockerComposeExecutable dockerComposeExecutable = mock(DockerComposeExecutable.class);
        when(dockerComposeExecutable.execute(anyVararg())).thenReturn(executedProcess);

        SynchronousDockerComposeExecutable dockerCompose = new SynchronousDockerComposeExecutable(dockerComposeExecutable);

        ProcessResult result = dockerCompose.run("rm", "-f");
        assertThat(result.exitCode(), is(1));
    }

    private void givenTheProcessTerminatesWithAnExitCodeOf(int exitCode) {
        when(executedProcess.exitValue()).thenReturn(exitCode);
    }

}

@@ -2081,20 +2081,125 @@
 g.junit.
-Test
+Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.runners.MockitoJUnitRunner
 ;%0A%0Aimpor
@@ -2364,48 +2364,8 @@
 rg;%0A
-import static org.mockito.Mockito.mock;%0A
 impo
@@ -2401,16 +2401,51 @@
 .when;%0A%0A
+@RunWith(MockitoJUnitRunner.class)%0A
 public c
@@ -2531,265 +2531,190 @@
 cess
- = mock(Process.class)
 ;%0A
-%0A
     
-@Test public void%0A    respond_with_the_process_exit_code() throws IOException %7B%0A        givenTheProcessTerminatesWithAnExitCodeOf(1);%0A        DockerComposeExecutable dockerComposeExecutable = mock(DockerComposeExecutable.class);
+private DockerComposeExecutable dockerComposeExecutable;%0A    private SynchronousDockerComposeExecutable dockerCompose;%0A%0A    @Before%0A    public void setup() throws IOException %7B
 %0A   
@@ -2798,25 +2798,24 @@
 ocess);%0A
-%0A
         
 Synchron
@@ -2810,43 +2810,8 @@
     
-SynchronousDockerComposeExecutable 
 dock
@@ -2891,71 +2891,154 @@
 e);%0A
-%0A        ProcessResult result = dockerCompose.run(%22rm%22, %22-f%22
+    %7D%0A%0A    @Test public void%0A    respond_with_the_process_exit_code() throws IOException %7B%0A        givenTheProcessTerminatesWithAnExitCodeOf(1
 );%0A
+%0A
     
@@ -3056,14 +3056,37 @@
 hat(
-result
+dockerCompose.run(%22rm%22, %22-f%22)
 .exi

Clean up test code