Guest User

Untitled

a guest
Feb 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. package datastructures;
  2.  
  3. import static org.junit.Assert.*;
  4.  
  5. import org.junit.Before;
  6. import org.junit.Test;
  7.  
  8. public class MyQueueTest {
  9.  
  10. @Before
  11. public void setUp() throws Exception {
  12.  
  13. }
  14.  
  15. @Test
  16. public void testAdd() {
  17. IList<Integer> list = new Queue<Integer>();
  18. list.add(1);
  19. list.add(2);
  20. list.add(3);
  21. list.add(3);
  22. list.add(4);
  23.  
  24. assertTrue(list.item() == 1);
  25.  
  26. }
  27.  
  28. @Test
  29. public void testRemove() {
  30. IList<Integer> list = new Queue<Integer>();
  31. list.add(1);
  32. list.add(2);
  33. list.add(3);
  34. list.add(3);
  35. list.add(4);
  36.  
  37. list.remove();
  38. assertTrue(list.item() == 2);
  39.  
  40. list.remove();
  41. list.remove();
  42. assertTrue(list.item() == 3);
  43. }
  44.  
  45. @Test
  46. public void testItem() {
  47. IList<Integer> list = new Queue<Integer>();
  48. list.add(1);
  49. list.add(2);
  50. list.add(3);
  51. list.add(3);
  52. list.add(4);
  53.  
  54. assertTrue(list.item() == 1);
  55. }
  56.  
  57. @Test
  58. public void testIsEmpty() {
  59. IList<Integer> list = new Queue<Integer>();
  60. assertTrue(list.isEmpty() == true);
  61.  
  62. list.add(1);
  63. list.add(2);
  64. list.add(3);
  65. assertTrue(list.isEmpty() == false);
  66. }
  67.  
  68. }
Add Comment
Please, Sign In to add comment