DestinationUrl { public static DestinationUrl createDestinationUrl(String destination) { String[] split = splitDestination(destination); String host = split[0].trim(); String jmsDestination = split[1].trim(); return new DestinationUrl(host, jmsDestination); } private  DestinationUrl(String host, String jmsDestination); static DestinationUrl createDestinationUrl(String destination); String getHost(); String getJmsDestination();  }
@Test(expected = IllegalArgumentException.class) public void testInvalidPattern_shouldThrowError() throws Exception { DestinationUrl.createDestinationUrl("blub"); }
@Test(expected = IllegalArgumentException.class) public void testCreatingDestinationWithMoreThanOneQuestionMark_shouldThrowError() throws Exception { DestinationUrl.createDestinationUrl("bli?bla?blub"); }