private final void runTest(boolean useInputStream)
throws IOException, ParseException {
Date myDate = new Date(1101980374187L);
byte[] encoded =
new DerOutputStream(uTime, myDate).encoded;
DerInputStream dis = useInputStream
? new DerInputStream(new ByteArrayInputStream(encoded))
: new DerInputStream(encoded);
// the difference only fractional-seconds
assertEquals(187, (myDate.getTime()-((Date)uTime.decode(dis)).getTime()));
// midnight
myDate = new SimpleDateFormat("MM.dd.yyyy HH:mm").
parse("06.06.2004 00:00");
encoded =
new DerOutputStream(uTime, myDate).encoded;
dis = useInputStream
? new DerInputStream(new ByteArrayInputStream(encoded))
: new DerInputStream(encoded);
assertEquals(myDate, uTime.decode(dis));
}