### Question:
SimpleShuttle implements Shuttle { @Override public void send(Collection<Message> messages) { Validate.notNull(messages); Validate.noNullElements(messages); List<Message> filteredMessages = new ArrayList<>(messages.size()); messages.stream().forEach(x -> { try { Address dst = x.getDestinationAddress(); String dstPrefix = dst.getElement(0); Validate.isTrue(dstPrefix.equals(prefix)); filteredMessages.add(x); } catch (Exception e) { LOG.error("Error shuttling message: " + x, e); } }); LOG.debug("Shuttling {} messages", filteredMessages.size()); bus.add(filteredMessages); } SimpleShuttle(String prefix, Bus bus); @Override String getPrefix(); @Override void send(Collection<Message> messages);  }### Answer:
@Test public void mustReadMessagesFromBusWhenInsertedInToShuttle() throws InterruptedException { fixture.send(Arrays.asList(new Message(Address.fromString("src:fake1"), Address.fromString("test:sub1"), "hi1"))); fixture.send(Arrays.asList(new Message(Address.fromString("src:fake2"), Address.fromString("test:sub2"), "hi2"))); List<Object> read = bus.pull(); assertEquals(2, read.size()); assertEquals("src:fake1", ((Message) read.get(0)).getSourceAddress().toString()); assertEquals("test:sub1", ((Message) read.get(0)).getDestinationAddress().toString()); assertEquals("hi1", ((Message) read.get(0)).getMessage()); assertEquals("src:fake2", ((Message) read.get(1)).getSourceAddress().toString()); assertEquals("test:sub2", ((Message) read.get(1)).getDestinationAddress().toString()); assertEquals("hi2", ((Message) read.get(1)).getMessage()); }
@Test public void mustIgnoreMessagesBeingAddedThatHaveIncorrectDestinations() throws InterruptedException { fixture.send(Arrays.asList(new Message(Address.fromString("src:fake1"), Address.fromString("wrongdestination"), "hi1"))); fixture.send(Arrays.asList(new Message(Address.fromString("src:fake2"), Address.fromString("test:sub2"), "hi2"))); List<Object> read = bus.pull(); assertEquals(1, read.size()); assertEquals("src:fake2", ((Message) read.get(0)).getSourceAddress().toString()); assertEquals("test:sub2", ((Message) read.get(0)).getDestinationAddress().toString()); assertEquals("hi2", ((Message) read.get(0)).getMessage()); }