Преглед изворни кода

bob: update tests to 1.2.0 (#1184)

* bob: update tests to 1.2.0

* Update BobTest.java
Sam Warner пре 8 година
родитељ
комит
0976d09d45

+ 3
- 0
exercises/bob/.meta/src/reference/java/Bob.java Прегледај датотеку

7
         if (isSilence(input)) {
7
         if (isSilence(input)) {
8
             return "Fine. Be that way!";
8
             return "Fine. Be that way!";
9
         }
9
         }
10
+        if (isShout(input) && isQuestion(input)) {
11
+          return "Calm down, I know what I'm doing!";
12
+        }
10
         if (isShout(input)) {
13
         if (isShout(input)) {
11
             return "Whoa, chill out!";
14
             return "Whoa, chill out!";
12
         }
15
         }

+ 1
- 0
exercises/bob/.meta/version Прегледај датотеку

1
+1.2.0

+ 79
- 15
exercises/bob/src/test/java/BobTest.java Прегледај датотеку

32
 
32
 
33
     @Ignore("Remove to run test")
33
     @Ignore("Remove to run test")
34
     @Test
34
     @Test
35
+    public void shoutingGibberish() {
36
+        assertEquals(
37
+            "Whoa, chill out!",
38
+            bob.hey("FCECDFCAAB")
39
+        );
40
+    }
41
+
42
+    @Ignore("Remove to run test")
43
+    @Test
35
     public void askingAQuestion() {
44
     public void askingAQuestion() {
36
         assertEquals(
45
         assertEquals(
37
             "Sure.",
46
             "Sure.",
50
 
59
 
51
     @Ignore("Remove to run test")
60
     @Ignore("Remove to run test")
52
     @Test
61
     @Test
62
+    public void askingGibberish() {
63
+        assertEquals(
64
+            "Sure.",
65
+            bob.hey("fffbbcbeab?")
66
+        );
67
+    }
68
+
69
+    @Ignore("Remove to run test")
70
+    @Test
53
     public void talkingForcefully() {
71
     public void talkingForcefully() {
54
         assertEquals(
72
         assertEquals(
55
             "Whatever.",
73
             "Whatever.",
69
     @Test
87
     @Test
70
     public void forcefulQuestions() {
88
     public void forcefulQuestions() {
71
         assertEquals(
89
         assertEquals(
72
-            "Whoa, chill out!", bob.hey("WHAT THE HELL WERE YOU THINKING?")
90
+            "Calm down, I know what I'm doing!", bob.hey("WHAT THE HELL WERE YOU THINKING?")
73
         );
91
         );
74
     }
92
     }
75
 
93
 
107
 
125
 
108
     @Ignore("Remove to run test")
126
     @Ignore("Remove to run test")
109
     @Test
127
     @Test
110
-    public void shoutingWithUmlauts() {
111
-        assertEquals(
112
-            "Whoa, chill out!", bob.hey("\u00dcML\u00c4\u00dcTS!")
113
-        );
114
-    }
115
-
116
-    @Ignore("Remove to run test")
117
-    @Test
118
-    public void calmlySpeakingWithUmlauts() {
128
+    public void shoutingWithNoExclamationMark() {
119
         assertEquals(
129
         assertEquals(
120
-            "Whatever.", bob.hey("\u00dcML\u00e4\u00dcTS!")
130
+            "Whoa, chill out!", bob.hey("I HATE YOU")
121
         );
131
         );
122
     }
132
     }
123
 
133
 
124
     @Ignore("Remove to run test")
134
     @Ignore("Remove to run test")
125
     @Test
135
     @Test
126
-    public void shoutingWithNoExclamationMark() {
136
+    public void statementContainingQuestionMark() {
127
         assertEquals(
137
         assertEquals(
128
-            "Whoa, chill out!", bob.hey("I HATE YOU")
138
+            "Whatever.", bob.hey("Ending with ? means a question.")
129
         );
139
         );
130
     }
140
     }
131
 
141
 
132
     @Ignore("Remove to run test")
142
     @Ignore("Remove to run test")
133
     @Test
143
     @Test
134
-    public void statementContainingQuestionMark() {
144
+    public void nonLettersWithQuestion() {
135
         assertEquals(
145
         assertEquals(
136
-            "Whatever.", bob.hey("Ending with ? means a question.")
146
+            "Sure.", bob.hey(":) ?")
137
         );
147
         );
138
     }
148
     }
139
 
149
 
160
             "Fine. Be that way!", bob.hey("    ")
170
             "Fine. Be that way!", bob.hey("    ")
161
         );
171
         );
162
     }
172
     }
173
+
174
+    @Ignore("Remove to run test")
175
+    @Test
176
+    public void alternateSilence() {
177
+        assertEquals(
178
+            "Fine. Be that way!", bob.hey("\t\t\t\t\t\t\t\t\t\t")
179
+        );
180
+    }
181
+
182
+    @Ignore("Remove to run test")
183
+    @Test
184
+    public void multipleLineQuestion() {
185
+        assertEquals(
186
+            "Whatever.",
187
+            bob.hey("\nDoes this cryogenic chamber make me look fat?\nno")
188
+        );
189
+    }
190
+
191
+    @Ignore("Remove to run test")
192
+    @Test
193
+    public void startingWithWhitespace() {
194
+        assertEquals(
195
+            "Whatever.",
196
+            bob.hey("         hmmmmmmm...")
197
+        );
198
+    }
199
+
200
+    @Ignore("Remove to run test")
201
+    @Test
202
+    public void endingWithWhiteSpace() {
203
+        assertEquals(
204
+            "Sure.",
205
+            bob.hey("Okay if like my  spacebar  quite a bit?   ")
206
+        );
207
+    }
208
+
209
+    @Ignore("Remove to run test")
210
+    @Test
211
+    public void otherWhiteSpace() {
212
+        assertEquals(
213
+            "Fine. Be that way!",
214
+            bob.hey("\n\r \t")
215
+        );
216
+    }
217
+
218
+    @Ignore("Remove to run test")
219
+    @Test
220
+    public void nonQuestionEndingWithWhiteSpace() {
221
+        assertEquals(
222
+            "Whatever.",
223
+            bob.hey("This is a statement ending with whitespace      ")
224
+        );
225
+    }
226
+
163
 }
227
 }