Remove usage of raw parametrized types

This commit is contained in:
Mahmoud Ben Hassine
2023-07-04 19:03:18 +02:00
parent 5585749925
commit 167f3c427d
13 changed files with 49 additions and 49 deletions

View File

@@ -54,14 +54,14 @@ class JobParametersTests {
private JobParameters getNewParameters() {
Map<String, JobParameter<?>> parameterMap = new HashMap<>();
parameterMap.put("string.key1", new JobParameter("value1", String.class, true));
parameterMap.put("string.key2", new JobParameter("value2", String.class, true));
parameterMap.put("long.key1", new JobParameter(1L, Long.class, true));
parameterMap.put("long.key2", new JobParameter(2L, Long.class, true));
parameterMap.put("double.key1", new JobParameter(1.1, Double.class, true));
parameterMap.put("double.key2", new JobParameter(2.2, Double.class, true));
parameterMap.put("date.key1", new JobParameter(date1, Date.class, true));
parameterMap.put("date.key2", new JobParameter(date2, Date.class, true));
parameterMap.put("string.key1", new JobParameter<>("value1", String.class, true));
parameterMap.put("string.key2", new JobParameter<>("value2", String.class, true));
parameterMap.put("long.key1", new JobParameter<>(1L, Long.class, true));
parameterMap.put("long.key2", new JobParameter<>(2L, Long.class, true));
parameterMap.put("double.key1", new JobParameter<>(1.1, Double.class, true));
parameterMap.put("double.key2", new JobParameter<>(2.2, Double.class, true));
parameterMap.put("date.key1", new JobParameter<>(date1, Date.class, true));
parameterMap.put("date.key2", new JobParameter<>(date2, Date.class, true));
return new JobParameters(parameterMap);
}
@@ -148,14 +148,14 @@ class JobParametersTests {
String string1 = stringBuilder.toString();
Map<String, JobParameter<?>> parameterMap = new HashMap<>();
parameterMap.put("string.key2", new JobParameter("value2", String.class, true));
parameterMap.put("string.key1", new JobParameter("value1", String.class, true));
parameterMap.put("long.key2", new JobParameter(2L, Long.class, true));
parameterMap.put("long.key1", new JobParameter(1L, Long.class, true));
parameterMap.put("double.key2", new JobParameter(2.2, Double.class, true));
parameterMap.put("double.key1", new JobParameter(1.1, Double.class, true));
parameterMap.put("date.key2", new JobParameter(date2, Date.class, true));
parameterMap.put("date.key1", new JobParameter(date1, Date.class, true));
parameterMap.put("string.key2", new JobParameter<>("value2", String.class, true));
parameterMap.put("string.key1", new JobParameter<>("value1", String.class, true));
parameterMap.put("long.key2", new JobParameter<>(2L, Long.class, true));
parameterMap.put("long.key1", new JobParameter<>(1L, Long.class, true));
parameterMap.put("double.key2", new JobParameter<>(2.2, Double.class, true));
parameterMap.put("double.key1", new JobParameter<>(1.1, Double.class, true));
parameterMap.put("date.key2", new JobParameter<>(date2, Date.class, true));
parameterMap.put("date.key1", new JobParameter<>(date1, Date.class, true));
JobParameters testProps = new JobParameters(parameterMap);

View File

@@ -65,7 +65,7 @@ public abstract class AbstractExecutionContextSerializerTests {
@Test
void testSerializeStringJobParameter() throws Exception {
Map<String, Object> m1 = new HashMap<>();
m1.put("name", new JobParameter("foo", String.class));
m1.put("name", new JobParameter<>("foo", String.class));
Map<String, Object> m2 = serializationRoundTrip(m1);
@@ -75,7 +75,7 @@ public abstract class AbstractExecutionContextSerializerTests {
@Test
void testSerializeDateJobParameter() throws Exception {
Map<String, Object> m1 = new HashMap<>();
m1.put("birthDate", new JobParameter(new Date(123456790123L), Date.class));
m1.put("birthDate", new JobParameter<>(new Date(123456790123L), Date.class));
Map<String, Object> m2 = serializationRoundTrip(m1);
@@ -85,7 +85,7 @@ public abstract class AbstractExecutionContextSerializerTests {
@Test
void testSerializeDoubleJobParameter() throws Exception {
Map<String, Object> m1 = new HashMap<>();
m1.put("weight", new JobParameter(80.5D, Double.class));
m1.put("weight", new JobParameter<>(80.5D, Double.class));
Map<String, Object> m2 = serializationRoundTrip(m1);
@@ -95,7 +95,7 @@ public abstract class AbstractExecutionContextSerializerTests {
@Test
void testSerializeLongJobParameter() throws Exception {
Map<String, Object> m1 = new HashMap<>();
m1.put("age", new JobParameter(20L, Long.class));
m1.put("age", new JobParameter<>(20L, Long.class));
Map<String, Object> m2 = serializationRoundTrip(m1);
@@ -105,7 +105,7 @@ public abstract class AbstractExecutionContextSerializerTests {
@Test
void testSerializeNonIdentifyingJobParameter() throws Exception {
Map<String, Object> m1 = new HashMap<>();
m1.put("name", new JobParameter("foo", String.class, false));
m1.put("name", new JobParameter<>("foo", String.class, false));
Map<String, Object> m2 = serializationRoundTrip(m1);
@@ -115,7 +115,7 @@ public abstract class AbstractExecutionContextSerializerTests {
@Test
void testSerializeJobParameters() throws Exception {
Map<String, JobParameter<?>> jobParametersMap = new HashMap<>();
jobParametersMap.put("paramName", new JobParameter("paramValue", String.class));
jobParametersMap.put("paramName", new JobParameter<>("paramValue", String.class));
Map<String, Object> m1 = new HashMap<>();
m1.put("params", new JobParameters(jobParametersMap));

View File

@@ -96,7 +96,7 @@ public class JdbcJobExecutionDaoTests extends AbstractJobExecutionDaoTests {
void testDeleteJobExecutionParameters() {
// given
Map<String, JobParameter<?>> parameters = new HashMap<>();
parameters.put("string-param", new JobParameter("value", String.class));
parameters.put("string-param", new JobParameter<>("value", String.class));
JobExecution execution = new JobExecution(jobInstance, new JobParameters(parameters));
dao.saveJobExecution(execution);

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.
@@ -36,7 +36,7 @@ import org.springframework.batch.core.JobParameters;
class ChunkContextTests {
private final ChunkContext context = new ChunkContext(new StepContext(new JobExecution(new JobInstance(0L, "job"),
1L, new JobParameters(Collections.singletonMap("foo", new JobParameter("bar", String.class))))
1L, new JobParameters(Collections.singletonMap("foo", new JobParameter<>("bar", String.class))))
.createStepExecution("foo")));
@Test