CONNECTTimestamp extends Timestamp { public boolean isExpired(Date invocationDate) { if (getExpires() != null) { return getExpires().before(invocationDate == null ? new Date() : invocationDate); } return false; } CONNECTTimestamp(Element timestampElement);  CONNECTTimestamp(Timestamp timestamp); boolean isExpired(Date invocationDate); boolean verifyCreated(int timeToLive, int futureTimeToLive, Date invocationDate);  }
@Test public void testIsExpired_False() throws WSSecurityException, ParseException { Date invocationDate = dateFormat.parse(BEFORE_EXPIRE_TIME); CONNECTTimestamp connectTimestamp = new CONNECTTimestamp(TIMESTAMP_ELEMENT); boolean result = connectTimestamp.isExpired(invocationDate); assertFalse(result); }
@Test public void testIsExpired_True() throws ParseException, WSSecurityException { Date invocationDate = dateFormat.parse(AFTER_EXPIRE_TIME); CONNECTTimestamp connectTimestamp = new CONNECTTimestamp(TIMESTAMP_ELEMENT); ; assertTrue(connectTimestamp.isExpired(invocationDate)); }