public final void test_setDateLjava_util_Date() throws Exception {
Set taSet = TestUtils.getTrustAnchorSet();
assertNotNull("could not create test TrustAnchor set", taSet);
// test: 'date' is unset and param is null
PKIXParameters p = new PKIXParameters(taSet);
p.setDate(null);
assertNull(p.getDate());
// test: 'date' is not null
p = new PKIXParameters(taSet);
Date toBeSet = new Date(555L);
p.setDate(toBeSet);
assertEquals(555L, p.getDate().getTime());
// modify initial 'date' - it should be copied by constructor
toBeSet.setTime(0L);
// check that internal 'date' has not been
// changed by the above modification
assertEquals(555L, p.getDate().getTime());
// set another 'date'
p.setDate(new Date(333L));
assertEquals(333L, p.getDate().getTime());
// Regression for HARMONY-2882 (non-bug difference from RI)
p = new PKIXParameters(taSet);
p.setDate(new Date(555L));
p.setDate(null); // reset 'date' back to current time
assertNull(p.getDate());
}