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

BobTest.java 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import org.junit.Test;
  2. import org.junit.Ignore;
  3. import static org.junit.Assert.*;
  4. public class BobTest {
  5. private final Bob bob = new Bob();
  6. @Test
  7. public void saySomething() {
  8. assertEquals(
  9. "Whatever.",
  10. bob.hey("Tom-ay-to, tom-aaaah-to.")
  11. );
  12. }
  13. @Ignore("Remove to run test")
  14. @Test
  15. public void shouting() {
  16. assertEquals(
  17. "Whoa, chill out!",
  18. bob.hey("WATCH OUT!")
  19. );
  20. }
  21. @Ignore("Remove to run test")
  22. @Test
  23. public void askingAQuestion() {
  24. assertEquals(
  25. "Sure.",
  26. bob.hey("Does this cryogenic chamber make me look fat?")
  27. );
  28. }
  29. @Ignore("Remove to run test")
  30. @Test
  31. public void askingANumericQuestion() {
  32. assertEquals(
  33. "Sure.",
  34. bob.hey("You are, what, like 15?")
  35. );
  36. }
  37. @Ignore("Remove to run test")
  38. @Test
  39. public void talkingForcefully() {
  40. assertEquals(
  41. "Whatever.",
  42. bob.hey("Let's go make out behind the gym!")
  43. );
  44. }
  45. @Ignore("Remove to run test")
  46. @Test
  47. public void usingAcronymsInRegularSpeech() {
  48. assertEquals(
  49. "Whatever.", bob.hey("It's OK if you don't want to go to the DMV.")
  50. );
  51. }
  52. @Ignore("Remove to run test")
  53. @Test
  54. public void forcefulQuestions() {
  55. assertEquals(
  56. "Whoa, chill out!", bob.hey("WHAT THE HELL WERE YOU THINKING?")
  57. );
  58. }
  59. @Ignore("Remove to run test")
  60. @Test
  61. public void shoutingNumbers() {
  62. assertEquals(
  63. "Whoa, chill out!", bob.hey("1, 2, 3 GO!")
  64. );
  65. }
  66. @Ignore("Remove to run test")
  67. @Test
  68. public void onlyNumbers() {
  69. assertEquals(
  70. "Whatever.", bob.hey("1, 2, 3")
  71. );
  72. }
  73. @Ignore("Remove to run test")
  74. @Test
  75. public void questionWithOnlyNumbers() {
  76. assertEquals(
  77. "Sure.", bob.hey("4?")
  78. );
  79. }
  80. @Ignore("Remove to run test")
  81. @Test
  82. public void shoutingWithSpecialCharacters() {
  83. assertEquals(
  84. "Whoa, chill out!", bob.hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")
  85. );
  86. }
  87. @Ignore("Remove to run test")
  88. @Test
  89. public void shoutingWithUmlauts() {
  90. assertEquals(
  91. "Whoa, chill out!", bob.hey("\u00dcML\u00c4\u00dcTS!")
  92. );
  93. }
  94. @Ignore("Remove to run test")
  95. @Test
  96. public void calmlySpeakingWithUmlauts() {
  97. assertEquals(
  98. "Whatever.", bob.hey("\u00dcML\u00e4\u00dcTS!")
  99. );
  100. }
  101. @Ignore("Remove to run test")
  102. @Test
  103. public void shoutingWithNoExclamationMark() {
  104. assertEquals(
  105. "Whoa, chill out!", bob.hey("I HATE YOU")
  106. );
  107. }
  108. @Ignore("Remove to run test")
  109. @Test
  110. public void statementContainingQuestionMark() {
  111. assertEquals(
  112. "Whatever.", bob.hey("Ending with ? means a question.")
  113. );
  114. }
  115. @Ignore("Remove to run test")
  116. @Test
  117. public void prattlingOn() {
  118. assertEquals(
  119. "Sure.", bob.hey("Wait! Hang on. Are you going to be OK?")
  120. );
  121. }
  122. @Ignore("Remove to run test")
  123. @Test
  124. public void silence() {
  125. assertEquals(
  126. "Fine. Be that way!", bob.hey("")
  127. );
  128. }
  129. @Ignore("Remove to run test")
  130. @Test
  131. public void prolongedSilence() {
  132. assertEquals(
  133. "Fine. Be that way!", bob.hey(" ")
  134. );
  135. }
  136. }