Code review comment: I am not particularly familiar with this. If I change it in the following way, what method should I use to get the suppressed exception to make the required assertion by the next lines of code. ``` assertThatThrownBy(() ->store.replace(                                                     key,                                                     StringResourceVersion.notExisting(),                                                     newState)).isInstanceOf(StateHandleStore.NotExistException.class); ```

Code under review:
void testReplaceWithDeletingKeyWithFailingDiscard() throws Exception {
        new Context() {
            {
                runTest(
                        () -> {
                            leaderCallbackGrantLeadership();

                            final Exception discardException = new Exception("Unable to discard.");
                            final TestingLongStateHandleHelper.LongStateHandle oldState =
                                    addDeletingEntry(
                                            getLeaderConfigMap(),
                                            key,
                                            new TestingLongStateHandleHelper.LongStateHandle(
                                                    1337,
                                                    discardIdx -> {
                                                        throw discardException;
                                                    }));

                            final KubernetesStateHandleStore<
                                            TestingLongStateHandleHelper.LongStateHandle>
                                    store =
                                            new KubernetesStateHandleStore<>(
                                                    flinkKubeClient,
                                                    LEADER_CONFIGMAP_NAME,
                                                    longStateStorage,
                                                    filter,
                                                    LOCK_IDENTITY);
                            final TestingLongStateHandleHelper.LongStateHandle newState =
                                    new TestingLongStateHandleHelper.LongStateHandle(23456L);

                            assertThat(store.exists(key))
                                    .isEqualByComparingTo(StringResourceVersion.notExisting());
                            StateHandleStore.NotExistException exception =
                                    catchThrowableOfType(
                                            () ->
                                                    store.replace(
                                                            key,
                                                            StringResourceVersion.notExisting(),
                                                            newState),
                                            StateHandleStore.NotExistException.class);
                            assertThat(exception.getSuppressed()).hasSize(1);
                            assertThatChainOfCauses(exception.getSuppressed()[0])
                                    .anySatisfy(
                                            cause ->
                                                    assertThat(cause)
                                                            .isInstanceOf(
                                                                    discardException.getClass())
                                                            .hasMessageContaining(
                                                                    discardException.getMessage()));

                            
                            assertThat(TestingLongStateHandleHelper.getGlobalStorageSize())
                                    .isEqualTo(2);
                            assertThat(oldState.isDiscarded()).isFalse();
                            assertThat(newState.isDiscarded()).isTrue();
                        });
            }
        };
    }

Line commented on: catchThrowableOfType(

Revised code:
void testReplaceWithDeletingKeyWithFailingDiscard() throws Exception {
        new Context() {
            {
                runTest(
                        () -> {
                            leaderCallbackGrantLeadership();

                            final Exception discardException = new Exception("Unable to discard.");
                            final TestingLongStateHandleHelper.LongStateHandle oldState =
                                    addDeletingEntry(
                                            getLeaderConfigMap(),
                                            key,
                                            new TestingLongStateHandleHelper.LongStateHandle(
                                                    1337,
                                                    discardIdx -> {
                                                        throw discardException;
                                                    }));

                            final KubernetesStateHandleStore<
                                            TestingLongStateHandleHelper.LongStateHandle>
                                    store =
                                            new KubernetesStateHandleStore<>(
                                                    flinkKubeClient,
                                                    LEADER_CONFIGMAP_NAME,
                                                    longStateStorage,
                                                    filter,
                                                    LOCK_IDENTITY);
                            final TestingLongStateHandleHelper.LongStateHandle newState =
                                    new TestingLongStateHandleHelper.LongStateHandle(23456L);

                            assertThat(store.exists(key))
                                    .isEqualByComparingTo(StringResourceVersion.notExisting());
                            assertThatThrownBy(
                                            () ->
                                                    store.replace(
                                                            key,
                                                            StringResourceVersion.notExisting(),
                                                            newState))
                                    .satisfies(
                                            cause -> {
                                                assertThat(cause)
                                                        .isInstanceOf(
                                                                StateHandleStore.NotExistException
                                                                        .class);
                                                assertThat(cause.getSuppressed()).hasSize(1);
                                                assertThatChainOfCauses(cause.getSuppressed()[0])
                                                        .anySatisfy(
                                                                ex ->
                                                                        assertThat(ex)
                                                                                .isInstanceOf(
                                                                                        discardException
                                                                                                .getClass())
                                                                                .hasMessageContaining(
                                                                                        discardException
                                                                                                .getMessage()));
                                            });

                            
                            assertThat(TestingLongStateHandleHelper.getGlobalStorageSize())
                                    .isEqualTo(2);
                            assertThat(oldState.isDiscarded()).isFalse();
                            assertThat(newState.isDiscarded()).isTrue();
                        });
            }
        };
    }