### Question:
DirectGateway implements Gateway { public void writeMessage(Message message) { Validate.notNull(message); if (joinerLatch.getCount() == 0L) { throw new IllegalStateException(); } String srcPrefix = message.getSourceAddress().getElement(0); String dstPrefix = message.getDestinationAddress().getElement(0); Validate.isTrue(prefix.equals(srcPrefix)); Shuttle dstShuttle = outShuttles.get(dstPrefix); if (dstShuttle != null) { dstShuttle.send(message); } } private  DirectGateway(String prefix); static DirectGateway create(); static DirectGateway create(String prefix); @Override Shuttle getIncomingShuttle(); @Override void addOutgoingShuttle(Shuttle shuttle); @Override void removeOutgoingShuttle(String shuttlePrefix); void listen(Address listenAddress); void listen(String listenAddress); void unlisten(Address listenAddress); void unlisten(String listenAddress); void writeMessage(Message message); void writeMessage(Address source, Address destination, Object message); void writeMessage(String source, String destination, Object message); void writeMessage(Address destination, Object message); void writeMessage(String destination, Object message); Message readMessage(Address listenAddress, long timeout, TimeUnit unit); Message readMessage(String listenAddress, long timeout, TimeUnit unit); Message readMessage(Address listenAddress); Message readMessage(String listenAddress); @SuppressWarnings("unchecked") T readMessagePayloadOnly(Address listenAddress, long timeout, TimeUnit unit); @SuppressWarnings("unchecked") T readMessagePayloadOnly(String listenAddress, long timeout, TimeUnit unit); @SuppressWarnings("unchecked") T readMessagePayloadOnly(Address listenAddress); @SuppressWarnings("unchecked") T readMessagePayloadOnly(String listenAddress); @Override void close(); @Override void join();  }### Answer:
@Test public void mustFailToWriteWithBadSourcePrefix() throws InterruptedException { thrown.expect(IllegalArgumentException.class); direct1Gateway.writeMessage("xxxx:in", "direct2", "payload"); }