Skip to content

Commit 1c28dac

Browse files
fmbenhassineFBibonne
authored andcommitted
Add test cases to cover key generation for empty identifying job parameters set
Related to #4755 Signed-off-by: Fabrice Bibonne <[email protected]>
1 parent 0a530e0 commit 1c28dac

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Diff for: spring-batch-core/src/test/java/org/springframework/batch/core/DefaultJobKeyGeneratorTests.java

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2022 the original author or authors.
2+
* Copyright 2013-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -65,4 +65,22 @@ void testCreateJobKeyOrdering() {
6565
assertEquals(key1, key2);
6666
}
6767

68+
@Test
69+
public void testCreateJobKeyForEmptyParameters() {
70+
JobParameters jobParameters1 = new JobParameters();
71+
JobParameters jobParameters2 = new JobParameters();
72+
String key1 = jobKeyGenerator.generateKey(jobParameters1);
73+
String key2 = jobKeyGenerator.generateKey(jobParameters2);
74+
assertEquals(key1, key2);
75+
}
76+
77+
@Test
78+
public void testCreateJobKeyForEmptyParametersAndNonIdentifying() {
79+
JobParameters jobParameters1 = new JobParameters();
80+
JobParameters jobParameters2 = new JobParametersBuilder().addString("name", "foo", false).toJobParameters();
81+
String key1 = jobKeyGenerator.generateKey(jobParameters1);
82+
String key2 = jobKeyGenerator.generateKey(jobParameters2);
83+
assertEquals(key1, key2);
84+
}
85+
6886
}

0 commit comments

Comments
 (0)