11
11
public class MethodAttributesTest {
12
12
13
13
@ Test
14
- public void testMergeArrays () {
14
+ public void testMergeArrays () throws Exception {
15
15
MethodAttributes methodAttributes = new MethodAttributes ("application/json" , "application/xml" , Locale .ENGLISH );
16
16
17
17
String [] array1 = {"application/json" , "application/xml" };
18
18
String [] array2 = {"application/xml" , "application/yaml" };
19
19
20
20
String [] expected = {"application/json" , "application/xml" , "application/yaml" };
21
- String [] result = methodAttributes .mergeArrays (array1 , array2 );
21
+
22
+ Method mergeArraysMethod = MethodAttributes .class .getDeclaredMethod ("mergeArrays" , String [].class , String [].class );
23
+ mergeArraysMethod .setAccessible (true );
24
+ String [] result = (String []) mergeArraysMethod .invoke (methodAttributes , (Object ) array1 , (Object ) array2 );
22
25
23
26
assertArrayEquals (expected , result );
24
27
}
25
28
26
29
@ Test
27
- public void testMergeArraysWithNullArray1 () {
30
+ public void testMergeArraysWithNullArray1 () throws Exception {
28
31
MethodAttributes methodAttributes = new MethodAttributes ("application/json" , "application/xml" , Locale .ENGLISH );
29
32
30
33
String [] array1 = null ;
31
34
String [] array2 = {"application/xml" , "application/yaml" };
32
35
33
36
String [] expected = {"application/xml" , "application/yaml" };
34
- String [] result = methodAttributes .mergeArrays (array1 , array2 );
37
+
38
+ Method mergeArraysMethod = MethodAttributes .class .getDeclaredMethod ("mergeArrays" , String [].class , String [].class );
39
+ mergeArraysMethod .setAccessible (true );
40
+ String [] result = (String []) mergeArraysMethod .invoke (methodAttributes , (Object ) array1 , (Object ) array2 );
35
41
36
42
assertArrayEquals (expected , result );
37
43
}
@@ -61,4 +67,4 @@ public void testDefaultConsumesMediaType() {
61
67
62
68
assertArrayEquals (expectedConsumes , resultConsumes );
63
69
}
64
- }
70
+ }
0 commit comments