Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ListAll_Tests {
- private Command testCommand;
- private Team team;
- private Board board;
- private Bug bug;
- private ManagementFactory managementFactory;
- private ManagementRepository managementRepository;
- private Bug bugTest;
- @Before
- public void before() {
- managementFactory = new ManagementFactoryImpl();
- managementRepository = new ManagementRepositoryImpl();
- testCommand = new ListAll(managementFactory, managementRepository);
- team = new TeamImpl("teamToTest");
- managementRepository.addTeam(team.getName(), team);
- board = new BoardImpl("boardTest");
- team.addBoard(board);
- bug = new BugImpl("BugToTestt", BugStatusType.ACTIVE, SeverityType.CRITICAL, PriorityType.MEDIUM);
- bugTest = new BugImpl("BugToTestt33", BugStatusType.ACTIVE, SeverityType.CRITICAL, PriorityType.MEDIUM);
- board.addBug(bug);
- board.addBug(bugTest);
- }
- @Test(expected = IllegalArgumentException.class)
- public void execute_should_throwException_when_passedLessArguments() {
- // Arrange, Act, Assert
- testCommand.execute(emptyList());
- }
- @Test(expected = IllegalArgumentException.class)
- public void execute_should_throwException_when_passedMoreArguments() {
- // Arrange, Act & Assert
- testCommand.execute(asList(new String[7]));
- }
- @Test
- public void execute_should_listAllItems_whenPassedValidArguments() {
- // Arrange
- // Act
- String result = testCommand.execute(asList("teamToTest", "boardTest"));
- String expected = ("--LIST ALL ITEMS--" + System.lineSeparator() + bugTest.toString() + bug.toString());
- // Arrange
- Assert.assertEquals(expected, result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement