Remove unnecessary boxing/unboxing

This commit is contained in:
Mahmoud Ben Hassine
2023-06-12 16:17:32 +02:00
parent 7babb341f5
commit c5b4f1a777
26 changed files with 62 additions and 53 deletions

View File

@@ -96,7 +96,7 @@ class JobParametersBuilderTests {
assertEquals(date, parameters.getDate("SCHEDULE_DATE"));
assertEquals(1L, parameters.getLong("LONG").longValue());
assertEquals("string value", parameters.getString("STRING"));
assertEquals(1, parameters.getDouble("DOUBLE").doubleValue(), 1e-15);
assertEquals(1, parameters.getDouble("DOUBLE"), 1e-15);
assertFalse(parameters.getParameters().get("SCHEDULE_DATE").isIdentifying());
assertFalse(parameters.getParameters().get("LONG").isIdentifying());
assertFalse(parameters.getParameters().get("STRING").isIdentifying());
@@ -112,7 +112,7 @@ class JobParametersBuilderTests {
JobParameters parameters = this.parametersBuilder.toJobParameters();
assertEquals(date, parameters.getDate("SCHEDULE_DATE"));
assertEquals(1L, parameters.getLong("LONG").longValue());
assertEquals(1, parameters.getDouble("DOUBLE").doubleValue(), 1e-15);
assertEquals(1, parameters.getDouble("DOUBLE"), 1e-15);
assertEquals("string value", parameters.getString("STRING"));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -249,7 +249,7 @@ class StepParserStepFactoryBeanTests {
assertTrue(step instanceof TaskletStep);
Object throttleLimit = ReflectionTestUtils.getField(ReflectionTestUtils.getField(step, "stepOperations"),
"throttleLimit");
assertEquals(Integer.valueOf(10), throttleLimit);
assertEquals(10, throttleLimit);
Object tasklet = ReflectionTestUtils.getField(step, "tasklet");
assertTrue(tasklet instanceof ChunkOrientedTasklet<?>);
assertFalse((Boolean) ReflectionTestUtils.getField(tasklet, "buffering"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -90,7 +90,7 @@ public class StepParserTests {
TaskletStep bean = (TaskletStep) factory.getObject();
assertEquals(25, bean.getStartLimit(), "wrong start-limit:");
Object throttleLimit = ReflectionTestUtils.getField(factory, "throttleLimit");
assertEquals(Integer.valueOf(10), throttleLimit);
assertEquals(10, throttleLimit);
}
@Test

View File

@@ -51,7 +51,7 @@ public abstract class AbstractExecutionContextSerializerTests {
@Test
void testSerializeAMap() throws Exception {
Map<String, Object> m1 = new HashMap<>();
m1.put("object1", Long.valueOf(12345L));
m1.put("object1", 12345L);
m1.put("object2", "OBJECT TWO");
// Use a date after 1971 (otherwise daylight saving screws up)...
m1.put("object3", new Date(123456790123L));
@@ -141,7 +141,7 @@ public abstract class AbstractExecutionContextSerializerTests {
ComplexObject o1 = new ComplexObject();
o1.setName("02345");
Map<String, Object> m = new HashMap<>();
m.put("object1", Long.valueOf(12345L));
m.put("object1", 12345L);
m.put("object2", "OBJECT TWO");
o1.setMap(m);
o1.setNumber(new BigDecimal("12345.67"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2022 the original author or authors.
* Copyright 2008-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -181,7 +181,7 @@ public abstract class AbstractJobInstanceDaoTests {
String paramKey = "myID";
int instanceCount = 6;
for (int i = 1; i <= instanceCount; i++) {
JobParameters params = new JobParametersBuilder().addLong(paramKey, Long.valueOf(i)).toJobParameters();
JobParameters params = new JobParametersBuilder().addLong(paramKey, (long) i).toJobParameters();
dao.createJobInstance(multiInstanceJob, params);
}