RESOLVED - BATCH-1826: Null pointer exception if optional parameter of

type DATE is null
This commit is contained in:
Robert Kasanicky
2012-04-06 15:51:29 +02:00
parent 610bfb8687
commit c1f3b9cbc4
2 changed files with 20 additions and 0 deletions

View File

@@ -252,4 +252,21 @@ public class DefaultJobParametersConverterTests {
private boolean contains(String str, String searchStr) {
return str.indexOf(searchStr) != -1;
}
@Test
public void testGetPropertiesWithNullValues() throws Exception {
JobParameters parameters = new JobParametersBuilder().addDate("schedule.date", null)
.addString("job.key", null).addLong("vendor.id", null).addDouble("double.key", null)
.toJobParameters();
Properties props = factory.getProperties(parameters);
assertNotNull(props);
final String NOT_FOUND = "NOT FOUND";
assertEquals(NOT_FOUND, props.getProperty("schedule.date", NOT_FOUND));
assertEquals(NOT_FOUND, props.getProperty("job.key", NOT_FOUND));
assertEquals(NOT_FOUND, props.getProperty("vendor.id", NOT_FOUND));
assertEquals(NOT_FOUND, props.getProperty("double.key", NOT_FOUND));
}
}