### Question:
SourceSequence extends AbstractSequence { public void setExpires(Expires ex) { Duration d = null; expires = null; if (null != ex) { d = ex.getValue(); } if (null != d && !d.equals(DatatypeFactory.PT0S)) { Date now = new Date(); expires = new Date(now.getTime() + ex.getValue().getTimeInMillis(now)); } } SourceSequence(Identifier i, ProtocolVariation pv);  SourceSequence(Identifier i, Date e, Identifier oi, ProtocolVariation pv);  SourceSequence(Identifier i, Date e, Identifier oi, long cmn, boolean lm, ProtocolVariation pv); long getCurrentMessageNr(); boolean isLastMessage(); Identifier getOfferingSequenceIdentifier(); String getEndpointIdentifier(); Date getExpires(); boolean offeredBy(Identifier sid); boolean needAcknowledge(long num); boolean allAcknowledged(); void setAcknowledged(SequenceAcknowledgement ack); Source getSource(); void setExpires(Expires ex); long nextMessageNumber(Identifier inSeqId, long inMsgNumber, boolean last); synchronized void setTarget(EndpointReferenceType to); synchronized EndpointReferenceType getTarget();  }### Answer:
@Test public void testSetExpires() { SourceSequence seq = new SourceSequence(id, ProtocolVariation.RM10WSA200408); Expires expires = factory.createExpires(); seq.setExpires(expires); assertFalse(seq.isExpired()); Duration d = DatatypeFactory.PT0S; expires.setValue(d); seq.setExpires(expires); try { Thread.sleep(1000); } catch (InterruptedException ex) { assertFalse(seq.isExpired()); } d = DatatypeFactory.createDuration("PT1S"); expires.setValue(d); seq.setExpires(expires); assertFalse(seq.isExpired()); d = DatatypeFactory.createDuration("-PT1S"); expires.setValue(d); seq.setExpires(expires); assertTrue(seq.isExpired()); }