@@ -0,0 +1,2292 @@
+package seedu.address.ui;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.experimental.categories.Category;%0Aimport org.loadui.testfx.GuiTest;%0Aimport org.mockito.Mock;%0Aimport org.mockito.Mockito;%0Aimport org.mockito.MockitoAnnotations;%0A%0Aimport javafx.scene.Parent;%0Aimport javafx.scene.control.TextField;%0Aimport javafx.scene.input.KeyCode;%0Aimport seedu.address.commons.core.EventsCenter;%0Aimport seedu.address.commons.events.ui.IncorrectCommandAttemptedEvent;%0Aimport seedu.address.logic.Logic;%0Aimport seedu.address.logic.commands.CommandResult;%0Aimport seedu.address.testutil.GuiTests;%0A%0A/**%0A * Unit Tests for CommandBox.%0A */%0A@Category(%7BGuiTests.class%7D)%0Apublic class CommandBoxTest extends GuiTest %7B%0A%0A    @Mock%0A    private Logic logic;%0A%0A    @Mock%0A    private ResultDisplay resultDisplay;%0A%0A    private CommandBox commandBox;%0A%0A    private TextField textField;%0A%0A    @Override%0A    protected Parent getRootNode() %7B%0A        MockitoAnnotations.initMocks(this);%0A        commandBox = new CommandBox(resultDisplay, logic);%0A        return commandBox.getRoot();%0A    %7D%0A%0A    @Before%0A    public void setupNodes() %7B%0A        textField = find(%22#commandTextField%22);%0A    %7D%0A%0A    @Test%0A    public void commandInputChanged_callsLogicExecute() %7B%0A        final String inputCommand = %22some command%22;%0A        final CommandResult result = new CommandResult(%22some result%22);%0A        Mockito.when(logic.execute(inputCommand)).thenReturn(result);%0A%0A        textField.setText(inputCommand);%0A        clickOn(textField).push(KeyCode.ENTER);%0A%0A        Mockito.verify(logic).execute(inputCommand);%0A        Mockito.verify(resultDisplay).postMessage(result.feedbackToUser);%0A        assertEquals(%22%22, textField.getText());%0A    %7D%0A%0A    @Test%0A    public void incorrectCommand_restoresCommandText() %7B%0A        final String inputCommand = %22some command%22;%0A        final CommandResult result = new CommandResult(%22some result%22);%0A        Mockito.when(logic.execute(inputCommand)).thenReturn(result);%0A%0A        textField.setText(inputCommand);%0A        clickOn(textField).push(KeyCode.ENTER);%0A        assertEquals(%22%22, textField.getText());%0A%0A        EventsCenter.getInstance().post(new IncorrectCommandAttemptedEvent(null));%0A        assertEquals(inputCommand, textField.getText());%0A    %7D%0A%0A%7D%0A

add CommandBoxTest