Skip to content

Commit aa28294

Browse files
committed
Expand test coverage for gh-14200
1 parent 6ca8fbc commit aa28294

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,19 @@ void convertPrimitiveByteArrayToByteWrapperArray() {
666666
assertThat(converted).isEqualTo(new Byte[]{1, 2, 3});
667667
}
668668

669-
@Test
669+
@Test // gh-14200, SPR-9566
670+
void convertPrimitiveByteArrayToPrimitiveByteArray() {
671+
byte[] byteArray = new byte[] {1, 2, 3};
672+
byte[] result = conversionService.convert(byteArray, byte[].class);
673+
assertThat(result).isSameAs(byteArray);
674+
assertThat(result).containsExactly(1, 2, 3);
675+
}
676+
677+
@Test // gh-14200, SPR-9566
670678
void convertIntArrayToIntArray() {
671-
int[] result = conversionService.convert(new int[] {1, 2, 3}, int[].class);
679+
int[] intArray = new int[] {1, 2, 3};
680+
int[] result = conversionService.convert(intArray, int[].class);
681+
assertThat(result).isSameAs(intArray);
672682
assertThat(result).containsExactly(1, 2, 3);
673683
}
674684

spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,12 @@ void conditionalConversionForAllTypes() {
461461
assertThat(converter.getSourceTypes().stream().allMatch(td -> Integer.class.equals(td.getType()))).isTrue();
462462
}
463463

464-
@Test
464+
@Test // gh-14200, SPR-9566
465465
void convertOptimizeArray() {
466-
// SPR-9566
467466
byte[] byteArray = new byte[] { 1, 2, 3 };
468467
byte[] converted = conversionService.convert(byteArray, byte[].class);
469468
assertThat(converted).isSameAs(byteArray);
469+
assertThat(converted).containsExactly(1, 2, 3);
470470
}
471471

472472
@Test

0 commit comments

Comments
 (0)