@Test public void testHandlerDispatching_WithReturnType() throws Throwable { Object actualReturnValue = testSubject.handle(GenericCommandMessage.asCommandMessage(1L), mockUnitOfWork); assertEquals(1L, actualReturnValue); assertEquals(0, mockTarget.voidHandlerInvoked); assertEquals(1, mockTarget.returningHandlerInvoked); }
@Test public void testHandlerDispatching_ThrowingException() throws Throwable { try { testSubject.handle(GenericCommandMessage.asCommandMessage(new HashSet()), mockUnitOfWork); fail("Expected exception"); } catch (Exception ex) { assertEquals(Exception.class, ex.getClass()); } }
@Test(expected = NoHandlerForCommandException.class) public void testHandle_NoHandlerForCommand() throws Throwable { testSubject.handle(GenericCommandMessage.asCommandMessage(new LinkedList()), null); }