package jfdi.test.logic.commands;

import jfdi.logic.commands.WildcardCommand;
import jfdi.logic.events.NoSurpriseEvent;
import jfdi.logic.events.SurpriseEvent;
import jfdi.storage.apis.TaskAttributes;
import org.junit.Test;

import java.util.ArrayList;

import static org.junit.Assert.*;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

/**
 * @author Liu Xinan
 */
public class WildcardCommandTest extends CommonCommandTest {

    @Test
    public void testExecute_successful() throws Exception {
        TaskAttributes task = new TaskAttributes();
        task.setDescription("Never gonna give you up");
        task.setCompleted(false);

        ArrayList<TaskAttributes> tasks = new ArrayList<>();
        tasks.add(task);

        when(taskDb.getAll()).thenReturn(tasks);

        WildcardCommand command = new WildcardCommand.Builder().build();

        assertNull(command.getLucky());

        command.execute();

        assertEquals(task, command.getLucky());
        verify(eventBus).post(any(SurpriseEvent.class));
    }

    @Test
    public void testExecute_unsuccessful() throws Exception {
        when(taskDb.getAll()).thenReturn(new ArrayList<>());

        WildcardCommand command = new WildcardCommand.Builder().build();

        assertNull(command.getLucky());

        command.execute();

        assertNull(command.getLucky());
        verify(eventBus).post(any(NoSurpriseEvent.class));
    }

    @Test
    public void undo() throws Exception {
        WildcardCommand command = new WildcardCommand.Builder().build();

        thrown.expect(AssertionError.class);
        command.undo();
    }

}

@@ -217,16 +217,96 @@
 it.Test;
+%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.runners.MockitoJUnitRunner;
 %0A%0Aimport
@@ -514,16 +514,51 @@
 nan%0A */%0A
+@RunWith(MockitoJUnitRunner.class)%0A
 public c

Add missing `@RunWith` annotation to `WildcardCommandTest`