forked from nus-cs2103-AY2324S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from feifeiraindrops/test-list
Add test to listAll
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/test/java/seedu/modulight/logic/commands/ListAllCommandTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package seedu.modulight.logic.commands; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static seedu.modulight.logic.commands.CommandTestUtil.assertCommandSuccess; | ||
import static seedu.modulight.testutil.TypicalStudents.getTypicalComponentBook; | ||
import static seedu.modulight.testutil.TypicalStudents.getTypicalScoreBook; | ||
import static seedu.modulight.testutil.TypicalStudents.getTypicalStudentBook; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.modulight.model.Model; | ||
import seedu.modulight.model.ModelManager; | ||
import seedu.modulight.model.UserPrefs; | ||
|
||
public class ListAllCommandTest { | ||
private Model model = new ModelManager(getTypicalStudentBook(), getTypicalScoreBook(), getTypicalComponentBook(), | ||
new UserPrefs()); | ||
private Model expectedModel = new ModelManager(getTypicalStudentBook(), getTypicalScoreBook(), | ||
getTypicalComponentBook(), new UserPrefs()); | ||
@Test | ||
public void excute_nonFiltered_success() { | ||
ListAllCommand command = new ListAllCommand(); | ||
String expectedMessage = "Listed all students, student scores and graded components"; | ||
assertCommandSuccess(command, model, expectedMessage, expectedModel); | ||
} | ||
|
||
@Test | ||
public void excute_filtered_success() { | ||
ListAllCommand command = new ListAllCommand(); | ||
model.updateFilteredStudentList(Model.PREDICATE_SHOW_NO_STUDENTS); | ||
model.updateFilteredGradedComponentList(Model.PREDICATE_SHOW_NO_COMPONENT); | ||
String expectedMessage = "Listed all students, student scores and graded components"; | ||
assertCommandSuccess(command, model, expectedMessage, expectedModel); | ||
} | ||
|
||
@Test | ||
public void equals() { | ||
|
||
ListAllCommand firstCommand = new ListAllCommand(); | ||
ListAllCommand secondCommand = new ListAllCommand(); | ||
|
||
// same object -> returns true | ||
assertTrue(firstCommand.equals(firstCommand)); | ||
|
||
// same type -> returns true | ||
assertTrue(firstCommand.equals(secondCommand)); | ||
|
||
// different types -> returns false | ||
assertFalse(firstCommand.equals(1)); | ||
|
||
// null -> returns false | ||
assertFalse(firstCommand.equals(null)); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/java/seedu/modulight/logic/parser/ListAllCommandParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package seedu.modulight.logic.parser; | ||
|
||
import static seedu.modulight.logic.parser.CommandParserTestUtil.assertParseSuccess; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.modulight.logic.commands.ListAllCommand; | ||
|
||
public class ListAllCommandParserTest { | ||
private ListAllCommandParser parser = new ListAllCommandParser(); | ||
@Test | ||
public void parse_noInput_success() { | ||
ListAllCommand expectedCommand = new ListAllCommand(); | ||
assertParseSuccess(parser, " ", expectedCommand); | ||
} | ||
|
||
@Test | ||
public void parse_withInput_success() { | ||
ListAllCommand expectedCommand = new ListAllCommand(); | ||
assertParseSuccess(parser, " t/t01 ", expectedCommand); | ||
} | ||
} |