package fitnesse.slim.instructions;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.*;

public class MakeInstructionTest {
  private static final String ID = "id_1";
  private static final String RESULT = "OK";

  private InstructionExecutor executor;

  @Before
  public void setUp() throws Exception {
    executor = mock(InstructionExecutor.class);
  }

  @Test
  public void shouldDelegateCallToExecutor() throws Exception {
    MakeInstruction instruction = new MakeInstruction(ID, "instance", "class", new Object[]{"arg1", "arg2"});

    instruction.execute(executor);

    verify(executor, times(1)).create("instance", "class", "arg1", "arg2");
  }

  @Test
  public void shouldFormatReturnValues() {
    MakeInstruction instruction = new MakeInstruction(ID, "instance", "class", new Object[]{"arg1", "arg2"});

    InstructionResult result = instruction.execute(executor);

    assertEquals(ID, result.getId());
    assertTrue(result.hasResult());
    assertFalse(result.hasError());
    assertEquals("OK", result.getResult());
  }
}

@@ -34,33 +34,8 @@
 s;%0A%0A
-import org.junit.Before;%0A
 impo
@@ -302,16 +302,17 @@
 %22id_1%22;%0A
+%0A
   privat
@@ -317,139 +317,33 @@
 ate 
-static final String RESULT = %22OK%22;%0A%0A  private InstructionExecutor executor;%0A%0A  @Before%0A  public void setUp() throws Exception %7B%0A   
+final InstructionExecutor
  exe
@@ -382,20 +382,16 @@
 .class);
-%0A  %7D
 %0A%0A  @Tes

Simplify test setup a bit