lots of exercises in java... from https://github.com/exercism/java

ClockEqualTest.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import org.junit.Ignore;
  2. import org.junit.Test;
  3. import static org.junit.Assert.assertNotEquals;
  4. import static org.junit.Assert.assertEquals;
  5. public class ClockEqualTest {
  6. @Ignore("Remove to run test")
  7. @Test
  8. public void clocksWithSameTimeAreEqual() {
  9. assertEquals(new Clock(15, 37), new Clock(15, 37));
  10. }
  11. @Ignore("Remove to run test")
  12. @Test
  13. public void clocksAMinuteApartAreNotEqual() {
  14. assertNotEquals(new Clock(15, 36), new Clock(15, 37));
  15. }
  16. @Ignore("Remove to run test")
  17. @Test
  18. public void clocksAnHourApartAreNotEqual() {
  19. assertNotEquals(new Clock(14, 37), new Clock(15, 37));
  20. }
  21. @Ignore("Remove to run test")
  22. @Test
  23. public void clocksWithHourOverflow() {
  24. assertEquals(new Clock(10, 37), new Clock(34, 37));
  25. }
  26. @Ignore("Remove to run test")
  27. @Test
  28. public void clocksWithHourOverflowBySeveralDays() {
  29. assertEquals(new Clock(3, 11), new Clock(99, 11));
  30. }
  31. @Ignore("Remove to run test")
  32. @Test
  33. public void clocksWithNegateHour() {
  34. assertEquals(new Clock(22, 40), new Clock(-2, 40));
  35. }
  36. @Ignore("Remove to run test")
  37. @Test
  38. public void clocksWithNegativeHourThatWraps() {
  39. assertEquals(new Clock(17, 3), new Clock(-31, 3));
  40. }
  41. @Ignore("Remove to run test")
  42. @Test
  43. public void clocksWithNegativeHourThatWrapsMultipleTimes() {
  44. assertEquals(new Clock(13, 49), new Clock(-83, 49));
  45. }
  46. @Ignore("Remove to run test")
  47. @Test
  48. public void clocksWithMinuteOverflow() {
  49. assertEquals(new Clock(0, 1), new Clock(0, 1441));
  50. }
  51. @Ignore("Remove to run test")
  52. @Test
  53. public void clocksWithMinuteOverflowBySeveralDays() {
  54. assertEquals(new Clock(2, 2), new Clock(2, 4322));
  55. }
  56. @Ignore("Remove to run test")
  57. @Test
  58. public void clocksWithNegativeMinutes() {
  59. assertEquals(new Clock(2, 40), new Clock(3, -20));
  60. }
  61. @Ignore("Remove to run test")
  62. @Test
  63. public void clocksWithNegativeMinutesThatWraps() {
  64. assertEquals(new Clock(4, 10), new Clock(5, -1490));
  65. }
  66. @Ignore("Remove to run test")
  67. @Test
  68. public void clocksWithNegativeMinutesThatWrapsMultipleTimes() {
  69. assertEquals(new Clock(6, 15), new Clock(6, -4305));
  70. }
  71. @Ignore("Remove to run test")
  72. @Test
  73. public void clocksWithNegativeHoursAndMinutes() {
  74. assertEquals(new Clock(7, 32), new Clock(-12, -268));
  75. }
  76. @Ignore("Remove to run test")
  77. @Test
  78. public void clocksWithNegativeHoursAndMinutesThatWrap() {
  79. assertEquals(new Clock(18, 7), new Clock(-54, -11513));
  80. }
  81. }