Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. //Lorenz
  2. @Test
  3. public void testIsParent() {
  4. System.out.println("isParent");
  5. Human parent = Rickard;
  6. Human child = Eddard;
  7. Stammbaum instance = new Stammbaum();
  8. boolean expResult = true;
  9. boolean result = instance.isParent(parent, child);
  10. assertEquals(expResult, result);
  11. }
  12. //Lorenz
  13. @Test
  14. public void testIsParent1() {
  15. System.out.println("isParent");
  16. Human parent = Lyarra;
  17. Human child = Lyanna;
  18. Stammbaum instance = new Stammbaum();
  19. boolean expResult = true;
  20. boolean result = instance.isParent(parent, child);
  21. assertEquals(expResult, result);
  22. }
  23. //Lorenz
  24. @Test
  25. public void testIsParent2() {
  26. System.out.println("isParent");
  27. Human parent = Rickard;
  28. Human child = Robb;
  29. Stammbaum instance = new Stammbaum();
  30. boolean expResult = false;
  31. boolean result = instance.isParent(parent, child);
  32. assertEquals(expResult, result);
  33. }
  34. //Lorenz
  35. @Test
  36. public void testIsParent3() {
  37. System.out.println("isParent");
  38. Human parent = Rickard;
  39. Human child = Lyarra;
  40. Stammbaum instance = new Stammbaum();
  41. boolean expResult = false;
  42. boolean result = instance.isParent(parent, child);
  43. assertEquals(expResult, result);
  44. }
  45. //Lorenz
  46. @Test
  47. public void testIsParent4() {
  48. System.out.println("isParent");
  49. Human parent = Lyanna;
  50. Human child = Jon;
  51. Stammbaum instance = new Stammbaum();
  52. boolean expResult = true;
  53. boolean result = instance.isParent(parent, child);
  54. assertEquals(expResult, result);
  55. }
  56. //Lorenz
  57. @Test
  58. public void testIsParent5() {
  59. System.out.println("isParent");
  60. Human parent = null;
  61. Human child = Jon;
  62. Stammbaum instance = new Stammbaum();
  63. boolean expResult = false;
  64. boolean result = instance.isParent(parent, child);
  65. assertEquals(expResult, result);
  66. }
  67.  
  68. //Lorenz
  69. @Test
  70. public void testIsGrandparentNULL() {
  71. System.out.println("isGrandparentNULL");
  72. Human grandparent = null;
  73. Human grandchild = null;
  74. Stammbaum instance = new Stammbaum();
  75. boolean expResult = false;
  76. boolean result = instance.isGrandparent(grandparent, grandchild);
  77. assertEquals(expResult, result);
  78. }
  79. //Lorenz
  80. @Test
  81. public void testGetAllGrandchildren() {
  82. System.out.println("getAllGrandchildren");
  83. Human grandparent = Lyarra;
  84. Stammbaum instance = new Stammbaum();
  85. List<Human> expResult = new ArrayList<>();
  86. expResult.add(Robb);
  87. expResult.add(Sansa);
  88. expResult.add(Arya);
  89. expResult.add(Bran);
  90. expResult.add(Rickon);
  91. expResult.add(Jon);
  92. Comparator<Human> comp = (Human h1, Human h2) -> h1.getName().compareTo(h2.getName());
  93. Collections.sort(expResult, comp);
  94. List<Human> result = instance.getAllGrandchildren(grandparent);
  95. Collections.sort(result, comp);
  96. assertEquals(expResult, result);
  97. }
  98. //Lorenz
  99. @Test
  100. public void testGetAllGrandchildren2() {
  101. System.out.println("getAllGrandchildren");
  102. Human grandparent = Brandon;
  103. Stammbaum instance = new Stammbaum();
  104. List<Human> expResult = new ArrayList<>();
  105. Comparator<Human> comp = (Human h1, Human h2) -> h1.getName().compareTo(h2.getName());
  106. Collections.sort(expResult, comp);
  107. List<Human> result = instance.getAllGrandchildren(grandparent);
  108. Collections.sort(result, comp);
  109. assertEquals(expResult, result);
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement