Skip to content

Commit 27224c0

Browse files
committed
Mark unchecked unit test methods with annotation.
1 parent d1273b6 commit 27224c0

File tree

8 files changed

+78
-1
lines changed

8 files changed

+78
-1
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<target>1.6</target>
5656
<encoding>UTF-8</encoding>
5757
<compilerArgument>-Xlint:unchecked</compilerArgument>
58+
<compilerArgument>-Xlint:deprecation</compilerArgument>
5859
</configuration>
5960
</plugin>
6061
<plugin>

src/test/java/com/github/underscore/ArraysTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public void head() {
8888
=> [3, 2, 1]
8989
*/
9090
@Test
91+
@SuppressWarnings("unchecked")
9192
public void rest() {
9293
final List<Integer> result = $.rest(asList(5, 4, 3, 2, 1));
9394
assertEquals("[4, 3, 2, 1]", result.toString());
@@ -111,6 +112,7 @@ public void rest() {
111112
// → [['a', 'b', 'c'], ['d']]
112113
*/
113114
@Test
115+
@SuppressWarnings("unchecked")
114116
public void chunk() {
115117
assertEquals("[[a, b], [c, d]]", $.chunk(asList("a", "b", "c", "d"), 2).toString());
116118
assertEquals("[[a, b], [c, d]]", new $(asList("a", "b", "c", "d")).chunk(2).toString());
@@ -166,6 +168,7 @@ public void drop() {
166168
=> [5, 4, 3]
167169
*/
168170
@Test
171+
@SuppressWarnings("unchecked")
169172
public void initial() {
170173
final List<Integer> result = $.initial(asList(5, 4, 3, 2, 1));
171174
assertEquals("[5, 4, 3, 2]", result.toString());
@@ -190,6 +193,7 @@ public void initial() {
190193
=> 1
191194
*/
192195
@Test
196+
@SuppressWarnings("unchecked")
193197
public void last() {
194198
final Integer result = $.last(asList(5, 4, 3, 2, 1));
195199
assertEquals("1", result.toString());
@@ -212,6 +216,7 @@ public void last() {
212216
=> [1, 2, 3]
213217
*/
214218
@Test
219+
@SuppressWarnings("unchecked")
215220
public void compact() {
216221
final List<?> result = $.compact(asList(0, 1, false, 2, "", 3));
217222
assertEquals("[1, 2, 3]", result.toString());
@@ -238,6 +243,7 @@ public void compact() {
238243
=> [1, 2, 3, 4];
239244
*/
240245
@Test
246+
@SuppressWarnings("unchecked")
241247
public void flatten() {
242248
final List<Integer> result = $.flatten(asList(1, asList(2, asList(3, asList(asList(4))))));
243249
assertEquals("[1, 2, 3, 4]", result.toString());
@@ -330,6 +336,7 @@ public int compareTo(Person person) {
330336
=> [1, 2, 3, 4]
331337
*/
332338
@Test
339+
@SuppressWarnings("unchecked")
333340
public void uniq() {
334341
final List<Integer> result = $.uniq(asList(1, 2, 1, 3, 1, 4));
335342
assertEquals("[1, 2, 3, 4]", result.toString());
@@ -378,6 +385,7 @@ public String apply(Person person) {
378385
=> [1, 2]
379386
*/
380387
@Test
388+
@SuppressWarnings("unchecked")
381389
public void intersection() {
382390
final List<Integer> result = $.intersection(asList(1, 2, 3), asList(101, 2, 1, 10), asList(2, 1));
383391
assertEquals("[1, 2]", result.toString());
@@ -395,6 +403,7 @@ public void intersection() {
395403
=> [1, 2, 3, 101, 10]
396404
*/
397405
@Test
406+
@SuppressWarnings("unchecked")
398407
public void union() {
399408
final List<Integer> result = $.union(asList(1, 2, 3), asList(101, 2, 1, 10), asList(2, 1));
400409
assertEquals("[1, 2, 3, 101, 10]", result.toString());
@@ -411,6 +420,7 @@ public void union() {
411420
=> [1, 3, 4]
412421
*/
413422
@Test
423+
@SuppressWarnings("unchecked")
414424
public void difference() {
415425
final List<Integer> result = $.difference(asList(1, 2, 3, 4, 5), asList(5, 2, 10));
416426
assertEquals("[1, 3, 4]", result.toString());
@@ -432,6 +442,7 @@ public void difference() {
432442
=> [["moe", 30, true], ["larry", 40, false], ["curly", 50, false]]
433443
*/
434444
@Test
445+
@SuppressWarnings("unchecked")
435446
public void zip() {
436447
final List<List<String>> result = $.zip(
437448
asList("moe", "larry", "curly"), asList("30", "40", "50"), asList("true", "false", "false"));
@@ -443,6 +454,7 @@ public void zip() {
443454
=> [['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]]
444455
*/
445456
@Test
457+
@SuppressWarnings("unchecked")
446458
public void unzip() {
447459
final List<List<String>> result = $.unzip(
448460
asList("moe", "30", "true"), asList("larry", "40", "false"), asList("curly", "50", "false"));

src/test/java/com/github/underscore/ChainingTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class ChainingTest {
4646
=> "moe is 21"
4747
*/
4848
@Test
49+
@SuppressWarnings("unchecked")
4950
public void chain() {
5051
final List<Map<String, Object>> stooges = new ArrayList<Map<String, Object>>() { {
5152
add(new LinkedHashMap<String, Object>() { { put("name", "curly"); put("age", 25); } });
@@ -70,6 +71,7 @@ public String apply(Map<String, Object> item) {
7071
}
7172

7273
@Test
74+
@SuppressWarnings("unchecked")
7375
public void chainSet() {
7476
final Set<Map<String, Object>> stooges = new HashSet<Map<String, Object>>() { {
7577
add(new LinkedHashMap<String, Object>() { { put("name", "curly"); put("age", 25); } });
@@ -94,6 +96,7 @@ public String apply(Map<String, Object> item) {
9496
}
9597

9698
@Test
99+
@SuppressWarnings("unchecked")
97100
public void chainObj() {
98101
final Set<Map<String, Object>> stooges = new HashSet<Map<String, Object>>() { {
99102
add(new LinkedHashMap<String, Object>() { { put("name", "curly"); put("age", 25); } });
@@ -118,6 +121,7 @@ public String apply(Map<String, Object> item) {
118121
}
119122

120123
@Test
124+
@SuppressWarnings("unchecked")
121125
public void chainArray() {
122126
final List<Map<String, Object>> stooges = new ArrayList<Map<String, Object>>() { {
123127
add(new LinkedHashMap<String, Object>() { { put("name", "curly"); put("age", 25); } });
@@ -161,6 +165,7 @@ public String apply(Map<String, Object> item) {
161165
=> {lumberjack: 2, all: 4, night: 2 ... }
162166
*/
163167
@Test
168+
@SuppressWarnings("unchecked")
164169
public void chain2() {
165170
final List<Map<String, Object>> lyrics = new ArrayList<Map<String, Object>>() { {
166171
add(new LinkedHashMap<String, Object>() { {
@@ -218,6 +223,7 @@ public Map<String, Integer> apply(Map<String, Integer> accum, String item) {
218223
=> {day=2, all=4, works=1 ... }
219224
*/
220225
@Test
226+
@SuppressWarnings("unchecked")
221227
public void chain3() {
222228
final List<Map<String, Object>> lyrics = new ArrayList<Map<String, Object>>() { {
223229
add(new LinkedHashMap<String, Object>() { {
@@ -280,6 +286,7 @@ public Map<String, Integer> apply(Map<String, Integer> accum, String item) {
280286
=> [{ doctorNumber: "#9", playedBy: "Christopher Eccleston", yearsPlayed: 1 }]
281287
*/
282288
@Test
289+
@SuppressWarnings("unchecked")
283290
public void chain4() {
284291
final List<Map<String, Object>> doctors = new ArrayList<Map<String, Object>>() { {
285292
add(new LinkedHashMap<String, Object>() { {
@@ -330,6 +337,7 @@ public Map<String, Object> apply(final Map<String, Object> item) {
330337
=> [{ number: 9, actor: "Christopher Eccleston", begin: 2005, end: 2005 }]
331338
*/
332339
@Test
340+
@SuppressWarnings("unchecked")
333341
public void chain5() {
334342
final List<Map<String, Object>> doctors = new ArrayList<Map<String, Object>>() { {
335343
add(new LinkedHashMap<String, Object>() { {
@@ -347,6 +355,7 @@ public void chain5() {
347355
}
348356

349357
@Test
358+
@SuppressWarnings("unchecked")
350359
public void chain6() {
351360
final List<String> result = $.chain($.class.getDeclaredMethods())
352361
.reduce(new FunctionAccum<List<String>, Method>() {
@@ -376,6 +385,7 @@ public Boolean apply(final String name) {
376385
=> 34
377386
*/
378387
@Test
388+
@SuppressWarnings("unchecked")
379389
public void chain7() {
380390
String[] words = new String[] {"Gallinule", "Escambio", "Aciform", "Entortilation", "Extensibility"};
381391
int sum = (Integer) $.chain(words)

0 commit comments

Comments
 (0)