@@ -21,18 +21,41 @@ public void tearDown() {
21
21
}
22
22
23
23
@ Test
24
- public void testGenericArgs () {
25
- Promise <List <Number >> p = ttt (BigDecimal .valueOf (10 ), Long .valueOf (11 ));
24
+ public void testGenericArgsWithList () {
25
+ Promise <List <Number >> p = combineWithList (BigDecimal .valueOf (10 ), Long .valueOf (11 ));
26
26
List <Number > v = p .join ();
27
27
assertTrue ("Fisrt is BigDecimal " , v .get (0 ) instanceof BigDecimal );
28
28
assertTrue ("Second is Long " , v .get (1 ) instanceof Long );
29
29
}
30
30
31
- <T , U extends T , V extends T > Promise <List <T >> ttt (U a , V b ) {
31
+ @ Test
32
+ public void testGenericArgsWithArray () {
33
+ Promise <List <Number >> p = combineWithArray1 (BigDecimal .valueOf (10 ), Long .valueOf (11 ));
34
+ List <Number > v = p .join ();
35
+ assertTrue ("Fisrt is BigDecimal " , v .get (0 ) instanceof BigDecimal );
36
+ assertTrue ("Second is Long " , v .get (1 ) instanceof Long );
37
+ }
38
+
39
+
40
+ <T , U extends T , V extends T > Promise <List <T >> combineWithList (U a , V b ) {
32
41
List <Promise <T >> promises = new ArrayList <>();
33
42
promises .add (Promises .success (a ));
34
43
promises .add (Promises .success (b ));
35
44
Promise <List <T >> all = Promises .all (promises );
36
45
return all ;
37
46
}
47
+
48
+ <T , U extends T , V extends T > Promise <List <T >> combineWithArray1 (U a , V b ) {
49
+ @ SuppressWarnings ("unchecked" )
50
+ Promise <T >[] promises = new Promise [2 ];
51
+ promises [0 ] = Promises .success (a );
52
+ promises [1 ] = Promises .success (b );
53
+ Promise <List <T >> all = Promises .all (promises );
54
+ return all ;
55
+ }
56
+
57
+ <T , U extends T , V extends T > Promise <List <T >> combineWithArray2 (U a , V b ) {
58
+ Promise <List <T >> all = Promises .all (Promises .success (a ), Promises .success (b ));
59
+ return all ;
60
+ }
38
61
}
0 commit comments