@Test public void testGetRoutingKey_NullValueWithRandomPolicy() throws Exception { testSubject = new AnnotationRoutingStrategy(UnresolvedRoutingKeyPolicy.RANDOM_KEY); CommandMessage<Object> command = new GenericCommandMessage<Object>(new Object()); // two calls should provide the same result assertFalse(testSubject.getRoutingKey(command).equals(testSubject.getRoutingKey(command))); }
@Test public void testGetRoutingKey() throws Exception { String actual = testSubject.getRoutingKey( new GenericCommandMessage<Object>(new StubCommand("SomeIdentifier"))); assertEquals("SomeIdentifier", actual); }
@Test(expected = CommandDispatchException.class) public void testGetRoutingKey_NoKey() throws Exception { assertNull(testSubject.getRoutingKey(new GenericCommandMessage<Object>("Just a String"))); }