Add @Disabled tests for primitive varargs array to Object[] conversion
This commit is contained in:
parent
e088892fc1
commit
ae5dd54115
|
@ -43,6 +43,7 @@ import java.util.UUID;
|
|||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
|
@ -603,6 +604,12 @@ class DefaultConversionServiceTests {
|
|||
assertThat(result).containsExactly(1, 2, 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertIntArrayToStringArray() {
|
||||
String[] result = conversionService.convert(new int[] {1, 2, 3}, String[].class);
|
||||
assertThat(result).containsExactly("1", "2", "3");
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertIntegerArrayToIntegerArray() {
|
||||
Integer[] result = conversionService.convert(new Integer[] {1, 2, 3}, Integer[].class);
|
||||
|
@ -615,6 +622,12 @@ class DefaultConversionServiceTests {
|
|||
assertThat(result).containsExactly(1, 2, 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertIntArrayToIntegerArray() {
|
||||
Integer[] result = conversionService.convert(new int[] {1, 2}, Integer[].class);
|
||||
assertThat(result).containsExactly(1, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertObjectArrayToIntegerArray() {
|
||||
Integer[] result = conversionService.convert(new Object[] {1, 2, 3}, Integer[].class);
|
||||
|
@ -627,15 +640,34 @@ class DefaultConversionServiceTests {
|
|||
assertThat(result).containsExactly(1, 2, 3);
|
||||
}
|
||||
|
||||
@Disabled("Primitive array to Object[] conversion is not currently supported")
|
||||
@Test
|
||||
void convertByteArrayToWrapperArray() {
|
||||
void convertIntArrayToObjectArray() {
|
||||
Object[] result = conversionService.convert(new int[] {1, 2}, Object[].class);
|
||||
assertThat(result).containsExactly(1, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertIntArrayToFloatArray() {
|
||||
Float[] result = conversionService.convert(new int[] {1, 2}, Float[].class);
|
||||
assertThat(result).containsExactly(1.0F, 2.0F);
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertIntArrayToPrimitiveFloatArray() {
|
||||
float[] result = conversionService.convert(new int[] {1, 2}, float[].class);
|
||||
assertThat(result).containsExactly(1.0F, 2.0F);
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertPrimitiveByteArrayToByteWrapperArray() {
|
||||
byte[] byteArray = {1, 2, 3};
|
||||
Byte[] converted = conversionService.convert(byteArray, Byte[].class);
|
||||
assertThat(converted).isEqualTo(new Byte[]{1, 2, 3});
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertArrayToArrayAssignable() {
|
||||
void convertIntArrayToIntArray() {
|
||||
int[] result = conversionService.convert(new int[] {1, 2, 3}, int[].class);
|
||||
assertThat(result).containsExactly(1, 2, 3);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.expression.Expression;
|
||||
|
@ -356,6 +357,13 @@ class MethodInvocationTests extends AbstractExpressionTests {
|
|||
evaluate("formatPrimitiveVarargs('x -> %s %s', '2', 3.0d)", "x -> 2 3", String.class);
|
||||
}
|
||||
|
||||
@Disabled("Primitive array to Object[] conversion is not currently supported")
|
||||
@Test
|
||||
void testVarargsWithPrimitiveArrayToObjectArrayConversion() {
|
||||
evaluate("formatObjectVarargs('x -> %s %s %s', new short[]{1, 2, 3})", "x -> 1 2 3", String.class); // short[] to Object[]
|
||||
evaluate("formatObjectVarargs('x -> %s %s %s', new int[]{1, 2, 3})", "x -> 1 2 3", String.class); // int[] to Object[]
|
||||
}
|
||||
|
||||
@Test
|
||||
void testVarargsOptionalInvocation() {
|
||||
// Calling 'public String optionalVarargsMethod(Optional<String>... values)'
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.expression.spel;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
|
@ -198,6 +199,21 @@ class VariableAndFunctionTests extends AbstractExpressionTests {
|
|||
evaluate("#formatPrimitiveVarargs('x -> %s %s %s', new String[]{'1', '2', '3'})", "x -> 1 2 3", String.class); // String[] to int[]
|
||||
}
|
||||
|
||||
@Disabled("Primitive array to Object[] conversion is not currently supported")
|
||||
@Test
|
||||
void functionFromMethodWithVarargsAndPrimitiveArrayToObjectArrayConversion() {
|
||||
evaluate("#varargsObjectFunction(new short[]{1, 2, 3})", "[1, 2, 3]", String.class); // short[] to Object[]
|
||||
evaluate("#varargsObjectFunction(new int[]{1, 2, 3})", "[1, 2, 3]", String.class); // int[] to Object[]
|
||||
}
|
||||
|
||||
@Disabled("Primitive array to Object[] conversion is not currently supported")
|
||||
@Test
|
||||
void functionFromMethodHandleWithVarargsAndPrimitiveArrayToObjectArrayConversion() {
|
||||
evaluate("#message('x -> %s %s %s', new short[]{1, 2, 3})", "x -> 1 2 3", String.class); // short[] to Object[]
|
||||
evaluate("#message('x -> %s %s %s', new int[]{1, 2, 3})", "x -> 1 2 3", String.class); // int[] to Object[]
|
||||
evaluate("#formatObjectVarargs('x -> %s %s %s', new int[]{1, 2, 3})", "x -> 1 2 3", String.class); // int[] to Object[]
|
||||
}
|
||||
|
||||
@Test
|
||||
void functionMethodMustBeStatic() throws Exception {
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
|
|
Loading…
Reference in New Issue