### Question:
RetransmissionQueueImpl implements RetransmissionQueue { public synchronized int countUnacknowledged(SourceSequence seq) { List<ResendCandidate> sequenceCandidates = getSequenceCandidates(seq); return sequenceCandidates == null ? 0 : sequenceCandidates.size(); } RetransmissionQueueImpl(RMManager m); RMManager getManager(); void setManager(RMManager m); void addUnacknowledged(Message message); synchronized int countUnacknowledged(SourceSequence seq); int countUnacknowledged(); boolean isEmpty(); void purgeAcknowledged(SourceSequence seq); void purgeAll(SourceSequence seq); List<Long> getUnacknowledgedMessageNumbers(SourceSequence seq); RetryStatus getRetransmissionStatus(SourceSequence seq, long num); Map<Long, RetryStatus> getRetransmissionStatuses(SourceSequence seq); void start(); void stop(SourceSequence seq); void suspend(SourceSequence seq); void resume(SourceSequence seq);  }### Answer:
@Test public void testCountUnacknowledged() { Long[] messageNumbers = {TEN, ONE}; SourceSequence sequence = setUpSequence("sequence1", messageNumbers, null); List<RetransmissionQueueImpl.ResendCandidate> sequenceList = new ArrayList<>(); queue.getUnacknowledged().put("sequence1", sequenceList); SoapMessage message1 = setUpMessage("sequence1", messageNumbers[0], false); setupMessagePolicies(message1); SoapMessage message2 = setUpMessage("sequence1", messageNumbers[1], false); setupMessagePolicies(message2); ready(false); sequenceList.add(queue.createResendCandidate(message1)); sequenceList.add(queue.createResendCandidate(message2)); assertEquals("unexpected unacked count", 2, queue.countUnacknowledged(sequence)); assertFalse("queue is empty", queue.isEmpty()); }
@Test public void testCountUnacknowledgedUnknownSequence() { Long[] messageNumbers = {TEN, ONE}; SourceSequence sequence = setUpSequence("sequence1", messageNumbers, null); ready(false); assertEquals("unexpected unacked count", 0, queue.countUnacknowledged(sequence)); }