@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
  public void testSubscribe() {
    testSubject.subscribe();

    verify(mockBus).subscribe(Long.class, testSubject);
    verify(mockBus).subscribe(String.class, testSubject);
    verify(mockBus).subscribe(HashSet.class, testSubject);
    verify(mockBus).subscribe(ArrayList.class, testSubject);
    verifyNoMoreInteractions(mockBus);
  }
 @Test(expected = NoHandlerForCommandException.class)
 public void testHandle_NoHandlerForCommand() throws Throwable {
   testSubject.handle(GenericCommandMessage.asCommandMessage(new LinkedList()), null);
 }