43
43
import java .util .regex .Pattern ;
44
44
import java .util .stream .Stream ;
45
45
46
+ import org .junit .jupiter .api .Disabled ;
46
47
import org .junit .jupiter .api .Test ;
47
48
48
49
import org .springframework .core .MethodParameter ;
@@ -603,6 +604,12 @@ void convertStringArrayToIntArray() {
603
604
assertThat (result ).containsExactly (1 , 2 , 3 );
604
605
}
605
606
607
+ @ Test
608
+ void convertIntArrayToStringArray () {
609
+ String [] result = conversionService .convert (new int [] {1 , 2 , 3 }, String [].class );
610
+ assertThat (result ).containsExactly ("1" , "2" , "3" );
611
+ }
612
+
606
613
@ Test
607
614
void convertIntegerArrayToIntegerArray () {
608
615
Integer [] result = conversionService .convert (new Integer [] {1 , 2 , 3 }, Integer [].class );
@@ -615,6 +622,12 @@ void convertIntegerArrayToIntArray() {
615
622
assertThat (result ).containsExactly (1 , 2 , 3 );
616
623
}
617
624
625
+ @ Test
626
+ void convertIntArrayToIntegerArray () {
627
+ Integer [] result = conversionService .convert (new int [] {1 , 2 }, Integer [].class );
628
+ assertThat (result ).containsExactly (1 , 2 );
629
+ }
630
+
618
631
@ Test
619
632
void convertObjectArrayToIntegerArray () {
620
633
Integer [] result = conversionService .convert (new Object [] {1 , 2 , 3 }, Integer [].class );
@@ -627,15 +640,34 @@ void convertObjectArrayToIntArray() {
627
640
assertThat (result ).containsExactly (1 , 2 , 3 );
628
641
}
629
642
643
+ @ Disabled ("Primitive array to Object[] conversion is not currently supported" )
644
+ @ Test
645
+ void convertIntArrayToObjectArray () {
646
+ Object [] result = conversionService .convert (new int [] {1 , 2 }, Object [].class );
647
+ assertThat (result ).containsExactly (1 , 2 );
648
+ }
649
+
650
+ @ Test
651
+ void convertIntArrayToFloatArray () {
652
+ Float [] result = conversionService .convert (new int [] {1 , 2 }, Float [].class );
653
+ assertThat (result ).containsExactly (1.0F , 2.0F );
654
+ }
655
+
656
+ @ Test
657
+ void convertIntArrayToPrimitiveFloatArray () {
658
+ float [] result = conversionService .convert (new int [] {1 , 2 }, float [].class );
659
+ assertThat (result ).containsExactly (1.0F , 2.0F );
660
+ }
661
+
630
662
@ Test
631
- void convertByteArrayToWrapperArray () {
663
+ void convertPrimitiveByteArrayToByteWrapperArray () {
632
664
byte [] byteArray = {1 , 2 , 3 };
633
665
Byte [] converted = conversionService .convert (byteArray , Byte [].class );
634
666
assertThat (converted ).isEqualTo (new Byte []{1 , 2 , 3 });
635
667
}
636
668
637
669
@ Test
638
- void convertArrayToArrayAssignable () {
670
+ void convertIntArrayToIntArray () {
639
671
int [] result = conversionService .convert (new int [] {1 , 2 , 3 }, int [].class );
640
672
assertThat (result ).containsExactly (1 , 2 , 3 );
641
673
}
0 commit comments