### Question:
SourceSequence extends AbstractSequence { public boolean allAcknowledged() { if (!lastMessage) { return false; } if (acknowledgement.getAcknowledgementRange().size() == 1) { AcknowledgementRange r = acknowledgement.getAcknowledgementRange().get(0); return r.getLower().longValue() == 1 && r.getUpper().longValue() == currentMessageNumber; } return false; } 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 testAllAcknowledged() throws RMException { SourceSequence seq = new SourceSequence(id, null, null, 4, false, ProtocolVariation.RM10WSA200408); setUpSource(); seq.setSource(source); assertFalse(seq.allAcknowledged()); seq.setLastMessage(true); assertFalse(seq.allAcknowledged()); SequenceAcknowledgement ack = factory.createSequenceAcknowledgement(); SequenceAcknowledgement.AcknowledgementRange r = factory.createSequenceAcknowledgementAcknowledgementRange(); r.setLower(Long.valueOf(1)); r.setUpper(Long.valueOf(2)); ack.getAcknowledgementRange().add(r); rq.purgeAcknowledged(seq); EasyMock.expectLastCall(); control.replay(); seq.setAcknowledged(ack); assertFalse(seq.allAcknowledged()); r.setUpper(Long.valueOf(4)); assertTrue(seq.allAcknowledged()); control.verify(); }