### Question:
RetransmissionQueueImpl implements RetransmissionQueue { protected ResendCandidate cacheUnacknowledged(Message message) { RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true); SequenceType st = rmps.getSequence(); Identifier sid = st.getIdentifier(); String key = sid.getValue(); ResendCandidate candidate = null; synchronized (this) { List<ResendCandidate> sequenceCandidates = getSequenceCandidates(key); if (null == sequenceCandidates) { sequenceCandidates = new ArrayList<>(); candidates.put(key, sequenceCandidates); } candidate = createResendCandidate(message); if (isSequenceSuspended(key)) { candidate.suspend(); } sequenceCandidates.add(candidate); unacknowledgedCount++; } LOG.fine("Cached unacknowledged message."); try { RMEndpoint rme = manager.getReliableEndpoint(message); rme.handleAccept(key, st.getMessageNumber(), message); } catch (RMException e) { LOG.log(Level.WARNING, "Could not find reliable endpoint for message"); } return candidate; } 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 testCacheUnacknowledged() { SoapMessage message1 = setUpMessage("sequence1", ONE); SoapMessage message2 = setUpMessage("sequence2", ONE); SoapMessage message3 = setUpMessage("sequence1", TWO); setupMessagePolicies(message1); setupMessagePolicies(message2); setupMessagePolicies(message3); endpoint.handleAccept("sequence1", 1, message1); EasyMock.expectLastCall(); endpoint.handleAccept("sequence2", 1, message2); EasyMock.expectLastCall(); endpoint.handleAccept("sequence1", 2, message3); EasyMock.expectLastCall(); ready(false); assertNotNull("expected resend candidate", queue.cacheUnacknowledged(message1)); assertEquals("expected non-empty unacked map", 1, queue.getUnacknowledged().size()); List<RetransmissionQueueImpl.ResendCandidate> sequence1List = queue.getUnacknowledged().get("sequence1"); assertNotNull("expected non-null context list", sequence1List); assertSame("expected context list entry", message1, sequence1List.get(0).getMessage()); assertNotNull("expected resend candidate", queue.cacheUnacknowledged(message2)); assertEquals("unexpected unacked map size", 2, queue.getUnacknowledged().size()); List<RetransmissionQueueImpl.ResendCandidate> sequence2List = queue.getUnacknowledged().get("sequence2"); assertNotNull("expected non-null context list", sequence2List); assertSame("expected context list entry", message2, sequence2List.get(0).getMessage()); assertNotNull("expected resend candidate", queue.cacheUnacknowledged(message3)); assertEquals("un expected unacked map size", 2, queue.getUnacknowledged().size()); sequence1List = queue.getUnacknowledged().get("sequence1"); assertNotNull("expected non-null context list", sequence1List); assertSame("expected context list entry", message3, sequence1List.get(1).getMessage()); }