Advertisement
Guest User

BoardTest

a guest
Jan 19th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. package WIMTest.Moduls;
  2.  
  3. import com.WIM.models.BoardImpl;
  4. import com.WIM.models.BugImpl;
  5. import com.WIM.models.FeedbackImpl;
  6. import com.WIM.models.StoryImpl;
  7. import com.WIM.models.contracts.Board;
  8. import com.WIM.models.contracts.WorkItem;
  9. import org.junit.Assert;
  10. import org.junit.Test;
  11.  
  12. public class Board_Test {
  13.  
  14.  
  15. @Test(expected = IllegalArgumentException.class)
  16. public void constructor_should_throwError_when_nameLengthLessThanMinimum() {
  17. //Arrange, Act, Assert
  18. Board board = new BoardImpl("boar");
  19. }
  20.  
  21. @Test(expected = IllegalArgumentException.class)
  22. public void constructor_should_throwError_when_nameLengthMoreThanMinimum() {
  23. //Arrange, Act, Assert
  24. Board board = new BoardImpl("12345678901");
  25. }
  26.  
  27. @Test
  28. public void constructor_should_createBoard_when_nameLengthIsInBounds() {
  29. //Arrange, Act, Assert
  30. Board board = new BoardImpl("board1");
  31. }
  32.  
  33. @Test
  34. public void constructor_should_createBoard_withEmptyHistory() {
  35. //Arrange, Act, Assert
  36. Board board = new BoardImpl("board1");
  37.  
  38. Assert.assertEquals(board.getHistory().isEmpty(), true);
  39. }
  40.  
  41. @Test
  42. public void constructor_should_createBoard_withNoWorkItems() {
  43. //Arrange, Assert
  44. Board board = new BoardImpl("board1");
  45. //Act
  46. Assert.assertEquals(board.getWorkItems().isEmpty(), true);
  47. }
  48.  
  49. @Test
  50. public void addItemInBoard_should_AddWorkItem_whenItemExist() {
  51. //Arrange
  52. Board board = new BoardImpl("board1");
  53. //Act
  54. WorkItem workItem = new FeedbackImpl("12345678901", (new String(new char[20])), "done");
  55. board.addItemInBoard(workItem);
  56. //Assert
  57. Assert.assertEquals(board.getWorkItems().size(), 1);
  58. }
  59.  
  60. @Test
  61. public void addHistory_should_AddHistory_whenInputIsValid() {
  62. //Arrange
  63. Board board = new BoardImpl("board1");
  64. String message = "hi there";
  65. //Act
  66. WorkItem workItem = new FeedbackImpl("12345678901", (new String(new char[20])), "done");
  67. board.addToBoardHistory(message);
  68. //Assert
  69. Assert.assertEquals(board.getHistory().size(), 1);
  70. }
  71.  
  72. @Test
  73. public void getName_should_returnName_whenInputIsValid() {
  74. Board board = new BoardImpl("board1");
  75. Assert.assertEquals("board1", board.getName());
  76. }
  77.  
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement