RESOLVED - BATCH-1853: If the JobParameters is asked for a Date value that doesn't exist, it will now return null rather than throwing NPE

This commit is contained in:
Lucas Ward
2012-05-04 10:17:16 -05:00
parent 60340e75b0
commit aa1c382c4c
2 changed files with 22 additions and 2 deletions

View File

@@ -191,4 +191,24 @@ public class JobParametersTests {
assertEquals(params, SerializationUtils.deserialize(serialized));
}
@Test
public void testLongReturns0WhenKeyDoesntExit(){
assertEquals(0L,new JobParameters().getLong("keythatdoesntexist"));
}
@Test
public void testStringReturnsNullWhenKeyDoesntExit(){
assertNull(new JobParameters().getString("keythatdoesntexist"));
}
@Test
public void testDoubleReturns0WhenKeyDoesntExit(){
assertEquals(0.0,new JobParameters().getLong("keythatdoesntexist"), 0.0001);
}
@Test
public void testDateReturnsNullWhenKeyDoesntExit(){
assertNull(new JobParameters().getDate("keythatdoesntexist"));
}
}