Rely on automatic boxing/unboxing in tests
Closes gh-29414
This commit is contained in:
committed by
Sam Brannen
parent
7d68d0625c
commit
b2c8546013
@@ -177,7 +177,7 @@ public abstract class AbstractExpressionTests {
|
||||
assertThat(ex.getMessageCode()).isEqualTo(expectedMessage);
|
||||
if (!ObjectUtils.isEmpty(otherProperties)) {
|
||||
// first one is expected position of the error within the string
|
||||
int pos = ((Integer) otherProperties[0]).intValue();
|
||||
int pos = (Integer) otherProperties[0];
|
||||
assertThat(ex.getPosition()).as("position").isEqualTo(pos);
|
||||
if (otherProperties.length > 1) {
|
||||
// Check inserts match
|
||||
@@ -207,7 +207,7 @@ public abstract class AbstractExpressionTests {
|
||||
assertThat(ex.getMessageCode()).isEqualTo(expectedMessage);
|
||||
if (otherProperties != null && otherProperties.length != 0) {
|
||||
// first one is expected position of the error within the string
|
||||
int pos = ((Integer) otherProperties[0]).intValue();
|
||||
int pos = (Integer) otherProperties[0];
|
||||
assertThat(pos).as("reported position").isEqualTo(pos);
|
||||
if (otherProperties.length > 1) {
|
||||
// Check inserts match
|
||||
|
||||
@@ -6203,7 +6203,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
|
||||
|
||||
public Reg(int v) {
|
||||
this._value = v;
|
||||
this._valueL = Long.valueOf(v);
|
||||
this._valueL = (long) v;
|
||||
this._valueD = (double) v;
|
||||
this._valueF = (float) v;
|
||||
}
|
||||
|
||||
@@ -637,7 +637,7 @@ class SpelReproTests extends AbstractExpressionTests {
|
||||
ConversionPriority1 target = new ConversionPriority1();
|
||||
MethodExecutor me = new ReflectiveMethodResolver(true).resolve(emptyEvalContext, target, "getX", args);
|
||||
// MethodInvoker chooses getX(int i) when passing Integer
|
||||
final int actual = (Integer) me.execute(emptyEvalContext, target, Integer.valueOf(42)).getValue();
|
||||
final int actual = (Integer) me.execute(emptyEvalContext, target, 42).getValue();
|
||||
// Compiler chooses getX(Number i) when passing Integer
|
||||
final int compiler = target.getX(INTEGER);
|
||||
// Fails!
|
||||
@@ -646,7 +646,7 @@ class SpelReproTests extends AbstractExpressionTests {
|
||||
ConversionPriority2 target2 = new ConversionPriority2();
|
||||
MethodExecutor me2 = new ReflectiveMethodResolver(true).resolve(emptyEvalContext, target2, "getX", args);
|
||||
// MethodInvoker chooses getX(int i) when passing Integer
|
||||
int actual2 = (Integer) me2.execute(emptyEvalContext, target2, Integer.valueOf(42)).getValue();
|
||||
int actual2 = (Integer) me2.execute(emptyEvalContext, target2, 42).getValue();
|
||||
// Compiler chooses getX(Number i) when passing Integer
|
||||
int compiler2 = target2.getX(INTEGER);
|
||||
// Fails!
|
||||
|
||||
@@ -37,7 +37,7 @@ public class FormatHelperTests {
|
||||
|
||||
@Test
|
||||
public void formatMethodWithMultipleArgumentsForMessage() {
|
||||
String message = FormatHelper.formatMethodForMessage("foo", Arrays.asList(TypeDescriptor.forObject("a string"), TypeDescriptor.forObject(Integer.valueOf(5))));
|
||||
String message = FormatHelper.formatMethodForMessage("foo", Arrays.asList(TypeDescriptor.forObject("a string"), TypeDescriptor.forObject(5)));
|
||||
assertThat(message).isEqualTo("foo(java.lang.String,java.lang.Integer)");
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ public class OpPlusTests {
|
||||
|
||||
assertThat(value.getTypeDescriptor().getObjectType()).isEqualTo(Double.class);
|
||||
assertThat(value.getTypeDescriptor().getType()).isEqualTo(Double.class);
|
||||
assertThat(value.getValue()).isEqualTo(Double.valueOf(123.0 + 456.0));
|
||||
assertThat(value.getValue()).isEqualTo(123.0 + 456.0);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -119,7 +119,7 @@ public class OpPlusTests {
|
||||
|
||||
assertThat(value.getTypeDescriptor().getObjectType()).isEqualTo(Long.class);
|
||||
assertThat(value.getTypeDescriptor().getType()).isEqualTo(Long.class);
|
||||
assertThat(value.getValue()).isEqualTo(Long.valueOf(123L + 456L));
|
||||
assertThat(value.getValue()).isEqualTo(123L + 456L);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -130,7 +130,7 @@ public class OpPlusTests {
|
||||
|
||||
assertThat(value.getTypeDescriptor().getObjectType()).isEqualTo(Integer.class);
|
||||
assertThat(value.getTypeDescriptor().getType()).isEqualTo(Integer.class);
|
||||
assertThat(value.getValue()).isEqualTo(Integer.valueOf(123 + 456));
|
||||
assertThat(value.getValue()).isEqualTo(123 + 456);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user