@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());
   }
 }
  @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
  private void checkException(
      final ArgumentCaptor<Exception> exceptionCaptor,
      final Class<? extends Exception> expectedException,
      final String expectedMessage) {
    final Exception exception = exceptionCaptor.getValue();

    assertEquals(expectedException, exception.getClass());
    assertEquals(expectedMessage, exception.getMessage());
  }
 private void assertInvalidParameter(long windowSize, long windowSlide) {
   try {
     new AccumulatingProcessingTimeWindowOperator<String, String, String>(
         mockFunction,
         mockKeySelector,
         StringSerializer.INSTANCE,
         StringSerializer.INSTANCE,
         windowSize,
         windowSlide);
     fail("This should fail with an IllegalArgumentException");
   } catch (IllegalArgumentException e) {
     // expected
   } catch (Exception e) {
     fail(
         "Wrong exception. Expected IllegalArgumentException but found "
             + e.getClass().getSimpleName());
   }
 }