SequenceFactory { public WilmaSequence createNewSequence(final String sequenceKey, final WilmaHttpRequest request, final long timeout) { WilmaSequencePairs messageStore = new WilmaSequencePairs(); RequestResponsePair firstPair = new RequestResponsePair(request); String loggerId = request.getWilmaMessageId(); messageStore.addStore(loggerId, firstPair); WilmaSequence sequence = new WilmaSequence(sequenceKey, new Timestamp(dateProvider.getCurrentTimeInMillis() + timeout), messageStore); return sequence; }  WilmaSequence createNewSequence(final String sequenceKey, final WilmaHttpRequest request, final long timeout);  }
@Test public void testCreateNewSequence() { String testKey = "TestKey"; String logggerId = "testId"; given(request.getWilmaMessageId()).willReturn(logggerId); WilmaSequence result = underTest.createNewSequence(testKey, request, 1000L); Assert.assertEquals(result.getSequenceKey(), testKey); Assert.assertFalse(result.isExpired(new Timestamp(1000L))); RequestResponsePair firstPair = result.getPairs().get(logggerId); Assert.assertEquals(firstPair.getRequest(), request); }