@Test
  public void propagatesNestedIllegalStateExceptionInObjectInputFilterException()
      throws InvocationTargetException, IllegalAccessException {
    StreamSerialFilter objectInputFilter =
        new ReflectiveFacadeStreamSerialFilter(api, "the-pattern", singleton("class-name"));
    InvocationTargetException invocationTargetException =
        new InvocationTargetException(new IllegalStateException("testing"), "testing");
    doThrow(invocationTargetException)
        .when(api).setObjectInputFilter(same(objectInputStream), any());

    Throwable thrown = catchThrowable(() -> {
      objectInputFilter.setFilterOn(objectInputStream);
    });

    assertThat(thrown)
        .isInstanceOf(FilterAlreadyConfiguredException.class)
        .hasMessage(
            "Unable to configure an input stream serialization filter because a non-null filter has already been set.")
        .hasCauseInstanceOf(InvocationTargetException.class)
        .hasRootCauseInstanceOf(IllegalStateException.class)
        .hasRootCauseMessage("testing");
  }
The ObjectInputFilter API throws IllegalStateException nested within InvocationTargetException
if a non-null filter already exists.
geode-serialization/src/test/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeObjectInputFilterTest.java