implement a whole bunch of simple methods.

PredicateUtilitiesTest.java 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. /**
  6. * The test class PredicateUtilitiesTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class PredicateUtilitiesTest
  12. {
  13. private PredicateUtilities math;
  14. /**
  15. * Default constructor for test class PredicateUtilitiesTest
  16. */
  17. public PredicateUtilitiesTest()
  18. {
  19. math = new PredicateUtilities();
  20. }
  21. /**
  22. * Sets up the test fixture.
  23. *
  24. * Called before every test case method.
  25. */
  26. @Before
  27. public void setUp()
  28. {
  29. }
  30. /**
  31. * Tears down the test fixture.
  32. *
  33. * Called after every test case method.
  34. */
  35. @After
  36. public void tearDown()
  37. {
  38. }
  39. @Test
  40. public void testGreaterThanTrue() {
  41. // : Given
  42. int greaterValue = 450;
  43. int lesserValue = 350;
  44. // : When
  45. boolean outcome = math.isGreaterThan(greaterValue, lesserValue);
  46. // : Then
  47. assertTrue(outcome);
  48. }
  49. @Test
  50. public void testGreaterThanFalse() {
  51. // : Given
  52. int greaterValue = 350;
  53. int lesserValue = 350;
  54. // : When
  55. boolean outcome = math.isGreaterThan(greaterValue, lesserValue);
  56. // : Then
  57. assertFalse(outcome);
  58. }
  59. @Test
  60. public void testLessThanTrue() {
  61. // : Given
  62. int greaterValue = 450;
  63. int lesserValue = 350;
  64. // : When
  65. boolean outcome = math.isLessThan(greaterValue, lesserValue);
  66. // : Then
  67. assertFalse(outcome);
  68. }
  69. @Test
  70. public void testLessThan1() {
  71. // : Given
  72. int greaterValue = 450;
  73. int lesserValue = 350;
  74. // : When
  75. boolean outcome = math.isLessThan(greaterValue, lesserValue);
  76. // : Then
  77. assertFalse(outcome);
  78. }
  79. @Test
  80. public void testLessOrEqual1() {
  81. // : Given
  82. int greaterValue = 3;
  83. int lesserValue = 3;
  84. // : When
  85. boolean outcome = math.isLessThanOrEqualTo(greaterValue, lesserValue);
  86. // : Then
  87. assertTrue(outcome);
  88. }
  89. @Test
  90. public void testLessOrEqual2() {
  91. // : Given
  92. int greaterValue = 3;
  93. int lesserValue = 6;
  94. // : When
  95. boolean outcome = math.isLessThanOrEqualTo(greaterValue, lesserValue);
  96. // : Then
  97. assertTrue(outcome);
  98. }
  99. @Test
  100. public void testGreaterOrEqual1() {
  101. // : Given
  102. int greaterValue = 4;
  103. int lesserValue = 4;
  104. // : When
  105. boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
  106. // : ThenP
  107. assertTrue(outcome);
  108. }
  109. @Test
  110. public void testGreaterOrEqual2() {
  111. // : Given
  112. int greaterValue = 8;
  113. int lesserValue = 15;
  114. // : When
  115. boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
  116. // : Then
  117. assertFalse(outcome);
  118. }
  119. }