@@ -0,0 +1,3248 @@
+package jfdi.test.logic.commands;%0A%0Aimport jfdi.logic.commands.SearchCommand;%0Aimport jfdi.storage.apis.TaskAttributes;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport java.util.ArrayList;%0A%0Aimport static org.junit.Assert.*;%0Aimport static org.mockito.Mockito.when;%0A%0A/**%0A * @author Liu Xinan%0A */%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class SearchCommandTest extends CommonCommandTest %7B%0A%0A    @Test%0A    public void testBuilder() throws Exception %7B%0A        ArrayList%3CString%3E keywords = new ArrayList%3C%3E();%0A        keywords.add(%22you%22);%0A        keywords.add(%22up%22);%0A%0A        SearchCommand command = new SearchCommand.Builder()%0A            .addKeyword(%22never%22)%0A            .addKeyword(%22gonna%22)%0A            .addKeyword(%22give%22)%0A            .addKeywords(keywords)%0A            .build();%0A%0A        assertTrue(command.getKeywords().contains(%22never%22));%0A        assertTrue(command.getKeywords().contains(%22gonna%22));%0A        assertTrue(command.getKeywords().contains(%22give%22));%0A        assertTrue(command.getKeywords().contains(%22you%22));%0A        assertTrue(command.getKeywords().contains(%22up%22));%0A        assertNull(command.getResults());%0A    %7D%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        super.setUp();%0A%0A        TaskAttributes neverGonnaGiveYouUp = new TaskAttributes();%0A        neverGonnaGiveYouUp.setDescription(%22Never gonna give you up%22);%0A        TaskAttributes never = new TaskAttributes();%0A        never.setDescription(%22never%22);%0A        TaskAttributes gonna = new TaskAttributes();%0A        gonna.setDescription(%22gonna%22);%0A        TaskAttributes give = new TaskAttributes();%0A        give.setDescription(%22give%22);%0A        TaskAttributes you = new TaskAttributes();%0A        you.setDescription(%22you%22);%0A        TaskAttributes up = new TaskAttributes();%0A        up.setDescription(%22up%22);%0A%0A        ArrayList%3CTaskAttributes%3E tasks = new ArrayList%3C%3E();%0A        tasks.add(neverGonnaGiveYouUp);%0A        tasks.add(never);%0A        tasks.add(gonna);%0A        tasks.add(give);%0A        tasks.add(you);%0A        tasks.add(up);%0A%0A        when(taskDb.getAll()).thenReturn(tasks);%0A    %7D%0A%0A    @Test%0A    public void testExecute_singleKeyword() throws Exception %7B%0A        SearchCommand command = new SearchCommand.Builder()%0A            .addKeyword(%22never%22)%0A            .build();%0A%0A        command.execute();%0A%0A        assertEquals(2, command.getResults().size());%0A    %7D%0A%0A    @Test%0A    public void testExecute_multipleKeyword() throws Exception %7B%0A        SearchCommand command = new SearchCommand.Builder()%0A            .addKeyword(%22never%22)%0A            .addKeyword(%22gonna%22)%0A            .addKeyword(%22give%22)%0A            .addKeyword(%22you%22)%0A            .addKeyword(%22up%22)%0A            .build();%0A%0A        command.execute();%0A%0A        assertEquals(6, command.getResults().size());%0A        assertEquals(%22Never gonna give you up%22, command.getResults().get(0).getDescription());%0A    %7D%0A%0A    @Test%0A    public void testUndo() throws Exception %7B%0A        SearchCommand command = new SearchCommand.Builder()%0A            .addKeyword(%22never%22)%0A            .addKeyword(%22gonna%22)%0A            .addKeyword(%22give%22)%0A            .build();%0A%0A        thrown.expect(AssertionError.class);%0A        command.undo();%0A    %7D%0A%0A%7D%0A

Add tests for `SearchCommand`