@Test
public void testAllPredecessorsAcknowledged() {
SequenceAcknowledgement ack = control.createMock(SequenceAcknowledgement.class);
List<AcknowledgementRange> ranges = new ArrayList<AcknowledgementRange>();
AcknowledgementRange r = control.createMock(AcknowledgementRange.class);
EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges);
control.replay();
DestinationSequence ds = new DestinationSequence(id, ref, null, ack);
ds.setDestination(destination);
assertTrue("all predecessors acknowledged", !ds.allPredecessorsAcknowledged(BigInteger.TEN));
control.verify();
control.reset();
ranges.add(r);
EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges).times(2);
EasyMock.expect(r.getLower()).andReturn(BigInteger.TEN);
control.replay();
assertTrue("all predecessors acknowledged", !ds.allPredecessorsAcknowledged(BigInteger.TEN));
control.verify();
control.reset();
EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges).times(3);
EasyMock.expect(r.getLower()).andReturn(BigInteger.ONE);
EasyMock.expect(r.getUpper()).andReturn(new BigInteger("5"));
control.replay();
assertTrue("all predecessors acknowledged", !ds.allPredecessorsAcknowledged(BigInteger.TEN));
control.verify();
control.reset();
EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges).times(3);
EasyMock.expect(r.getLower()).andReturn(BigInteger.ONE);
EasyMock.expect(r.getUpper()).andReturn(BigInteger.TEN);
control.replay();
assertTrue("not all predecessors acknowledged", ds.allPredecessorsAcknowledged(BigInteger.TEN));
control.verify();
ranges.add(r);