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