@@ -309,6 +309,20 @@ static void verify(final ImmutablePair<String, Object[]> a, final Object obj) {
309309 verify (a , pair );
310310 }
311311
312+ boolean unboxBooleanArray ;
313+
314+ boolean unboxByteArray ;
315+
316+ boolean unboxCharArray ;
317+
318+ boolean unboxDoubleArray ;
319+
320+ boolean unboxFloatArray ;
321+
322+ boolean unboxIntArray ;
323+
324+ boolean unboxLongArray ;
325+
312326 public String foo () {
313327 return "foo()" ;
314328 }
@@ -391,7 +405,38 @@ private String privateStringStuff(final String s) {
391405 private void privateStuff () {
392406 }
393407
408+ public boolean [] unboxing (final boolean ... values ) {
409+ unboxBooleanArray = true ;
410+ return values ;
411+ }
412+
413+ public byte [] unboxing (final byte ... values ) {
414+ unboxByteArray = true ;
415+ return values ;
416+ }
417+
418+ public char [] unboxing (final char ... values ) {
419+ unboxCharArray = true ;
420+ return values ;
421+ }
422+
423+ public double [] unboxing (final double ... values ) {
424+ unboxDoubleArray = true ;
425+ return values ;
426+ }
427+
428+ public float [] unboxing (final float ... values ) {
429+ unboxFloatArray = true ;
430+ return values ;
431+ }
432+
394433 public int [] unboxing (final int ... values ) {
434+ unboxIntArray = true ;
435+ return values ;
436+ }
437+
438+ public long [] unboxing (final long ... values ) {
439+ unboxLongArray = true ;
395440 return values ;
396441 }
397442
@@ -432,16 +477,14 @@ private static final class TestMutableSubclass extends TestMutable {
432477
433478 }
434479
435- private TestBean testBean ;
436-
437480 private final Map <Class <?>, Class <?>[]> classCache = new HashMap <>();
438481
439- private void expectMatchingAccessibleMethodParameterTypes ( final Class <?> cls ,
440- final String methodName , final Class <?>[] requestTypes , final Class <?>[] actualTypes ) {
441- final Method m = MethodUtils . getMatchingAccessibleMethod ( cls , methodName ,
442- requestTypes );
443- assertNotNull ( m , "could not find any matches for " + methodName
444- + " (" + (requestTypes == null ? null : toString (requestTypes )) + ")" );
482+ private TestBean testBean ;
483+
484+ private void expectMatchingAccessibleMethodParameterTypes ( final Class <?> cls , final String methodName , final Class <?>[] requestTypes ,
485+ final Class <?>[] actualTypes ) {
486+ final Method m = MethodUtils . getMatchingAccessibleMethod ( cls , methodName , requestTypes );
487+ assertNotNull ( m , "could not find any matches for " + methodName + " (" + (requestTypes == null ? null : toString (requestTypes )) + ")" );
445488 assertArrayEquals (actualTypes , m .getParameterTypes (), toString (m .getParameterTypes ()) + " not equals " + toString (actualTypes ));
446489 }
447490
@@ -1130,10 +1173,59 @@ void testNullArgument() {
11301173 }
11311174
11321175 @ Test
1133- void testVarArgsUnboxing () throws Exception {
1176+ void testVarArgsUnboxingBooleanArray () throws Exception {
1177+ final TestBean testBean = new TestBean ();
1178+ final boolean [] actual = (boolean []) MethodUtils .invokeMethod (testBean , "unboxing" , Boolean .TRUE , Boolean .FALSE );
1179+ assertArrayEquals (new boolean [] { true , false }, actual );
1180+ assertTrue (testBean .unboxBooleanArray );
1181+ }
1182+
1183+ @ Test
1184+ void testVarArgsUnboxingByteArray () throws Exception {
1185+ final TestBean testBean = new TestBean ();
1186+ final byte [] actual = (byte []) MethodUtils .invokeMethod (testBean , "unboxing" , Byte .valueOf ((byte ) 1 ), Byte .valueOf ((byte ) 2 ));
1187+ assertArrayEquals (new byte [] { 1 , 2 }, actual );
1188+ assertTrue (testBean .unboxByteArray );
1189+ }
1190+
1191+ @ Test
1192+ void testVarArgsUnboxingCharArray () throws Exception {
1193+ final TestBean testBean = new TestBean ();
1194+ final char [] actual = (char []) MethodUtils .invokeMethod (testBean , "unboxing" , Character .valueOf ((char ) 1 ), Character .valueOf ((char ) 2 ));
1195+ assertArrayEquals (new char [] { 1 , 2 }, actual );
1196+ assertTrue (testBean .unboxCharArray );
1197+ }
1198+
1199+ @ Test
1200+ void testVarArgsUnboxingDoubleArray () throws Exception {
1201+ final TestBean testBean = new TestBean ();
1202+ final double [] actual = (double []) MethodUtils .invokeMethod (testBean , "unboxing" , Double .valueOf (1 ), Double .valueOf (2 ));
1203+ assertArrayEquals (new double [] { 1 , 2 }, actual );
1204+ assertTrue (testBean .unboxDoubleArray );
1205+ }
1206+
1207+ @ Test
1208+ void testVarArgsUnboxingFloatArray () throws Exception {
1209+ final TestBean testBean = new TestBean ();
1210+ final float [] actual = (float []) MethodUtils .invokeMethod (testBean , "unboxing" , Float .valueOf (1 ), Float .valueOf (2 ));
1211+ assertArrayEquals (new float [] { 1 , 2 }, actual );
1212+ assertTrue (testBean .unboxFloatArray );
1213+ }
1214+
1215+ @ Test
1216+ void testVarArgsUnboxingIntArray () throws Exception {
11341217 final TestBean testBean = new TestBean ();
11351218 final int [] actual = (int []) MethodUtils .invokeMethod (testBean , "unboxing" , Integer .valueOf (1 ), Integer .valueOf (2 ));
1136- assertArrayEquals (new int []{1 , 2 }, actual );
1219+ assertArrayEquals (new int [] { 1 , 2 }, actual );
1220+ assertTrue (testBean .unboxIntArray );
1221+ }
1222+
1223+ @ Test
1224+ void testVarArgsUnboxingLongArray () throws Exception {
1225+ final TestBean testBean = new TestBean ();
1226+ final long [] actual = (long []) MethodUtils .invokeMethod (testBean , "unboxing" , Long .valueOf (1 ), Long .valueOf (2 ));
1227+ assertArrayEquals (new long [] { 1 , 2 }, actual );
1228+ assertTrue (testBean .unboxLongArray );
11371229 }
11381230
11391231 private String toString (final Class <?>[] c ) {
0 commit comments