SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class ListAll_Tests {
  2.     private Command testCommand;
  3.     private Team team;
  4.     private Board board;
  5.     private Bug bug;
  6.     private ManagementFactory managementFactory;
  7.     private ManagementRepository managementRepository;
  8.     private Bug bugTest;
  9.  
  10.     @Before
  11.     public void before() {
  12.         managementFactory = new ManagementFactoryImpl();
  13.         managementRepository = new ManagementRepositoryImpl();
  14.         testCommand = new ListAll(managementFactory, managementRepository);
  15.         team = new TeamImpl("teamToTest");
  16.         managementRepository.addTeam(team.getName(), team);
  17.         board = new BoardImpl("boardTest");
  18.         team.addBoard(board);
  19.         bug = new BugImpl("BugToTestt", BugStatusType.ACTIVE, SeverityType.CRITICAL, PriorityType.MEDIUM);
  20.         bugTest = new BugImpl("BugToTestt33", BugStatusType.ACTIVE, SeverityType.CRITICAL, PriorityType.MEDIUM);
  21.         board.addBug(bug);
  22.         board.addBug(bugTest);
  23.     }
  24.  
  25.     @Test(expected = IllegalArgumentException.class)
  26.     public void execute_should_throwException_when_passedLessArguments() {
  27.         // Arrange, Act, Assert
  28.         testCommand.execute(emptyList());
  29.     }
  30.  
  31.     @Test(expected = IllegalArgumentException.class)
  32.     public void execute_should_throwException_when_passedMoreArguments() {
  33.         // Arrange, Act & Assert
  34.         testCommand.execute(asList(new String[7]));
  35.     }
  36.  
  37.     @Test
  38.     public void execute_should_listAllItems_whenPassedValidArguments() {
  39.         // Arrange
  40.         // Act
  41.         String result = testCommand.execute(asList("teamToTest", "boardTest"));
  42.  
  43.         String expected = ("--LIST ALL ITEMS--" + System.lineSeparator() + bugTest.toString() + bug.toString());
  44.  
  45.         // Arrange
  46.         Assert.assertEquals(expected, result);
  47.     }
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top