### Question:
MemoryStore implements Store { @Override public void queueIn(String id, int offset, List<Message> messages) { Validate.notNull(id); Validate.notNull(messages); Validate.noNullElements(messages); Validate.isTrue(offset >= 0); Validate.validState(!closed, "Store closed"); messages.forEach(m -> { Address srcAddr = m.getSourceAddress(); Validate.isTrue(srcAddr.size() >= 2, "HTTP client address must have atleast 2 elements: %s", srcAddr); Validate.isTrue(srcAddr.getElement(0).equals(prefix), "HTTP client address must start with %s: %s", prefix, srcAddr); Validate.isTrue(srcAddr.getElement(1).equals(id), "HTTP client address must have ID with %s: %s", id, srcAddr); }); LockRegion lockRegion = getLockRegion(id); synchronized (lockRegion) { filterTimedOutContainers(lockRegion); Queues queue = lockRegion.queues.computeIfAbsent(id, k -> new Queues(id, clock.instant())); lockRegion.timeouts.remove(queue); queue.lastAccessTime = clock.instant(); lockRegion.timeouts.add(queue); List<byte[]> serializedMessages = messages.stream() .map(m -> lockRegion.serializer.serialize(m)) .collect(toList()); queue.inQueue.queue(offset, serializedMessages); } } MemoryStore(String prefix, int concurrency, Duration timeout);   MemoryStore(String prefix, int concurrency, Duration timeout, Clock clock); static MemoryStore create(String prefix, int concurrency, Duration timeout); @Override void queueOut(String id, List<Message> messages); @Override List<Message> dequeueOut(String id, int offset); @Override void queueIn(String id, int offset, List<Message> messages); @Override List<Message> dequeueIn(String id); @Override void close();  }### Answer:
@Test public void mustFailIfQueueInOnNonExistingOffset() { List<Message> expected = Arrays.asList( new Message("http:id", "dst:id1", "payload1"), new Message("http:id", "dst:id2", "payload2"), new Message("http:id", "dst:id3", "payload3") ); fixture.queueIn("id", 0, expected.subList(0, 1)); expectedException.expect(IllegalStateException.class); fixture.queueIn("id", 2, expected); }