public boolean isTerminated() {
        if (getInternalResource().getStatus() != null) {
            final boolean podFailed =
                    PodPhase.Failed.name().equals(getInternalResource().getStatus().getPhase());
            final boolean containersFailed =
                    getInternalResource().getStatus().getContainerStatuses().stream()
                            .anyMatch(
                                    e ->
                                            e.getState() != null
                                                    && e.getState().getTerminated() != null);
            return containersFailed || podFailed;
        }
        return false;
    }
@Test
    void testIsTerminatedShouldReturnTrueWhenPodFailed() {
        final Pod pod = new PodBuilder().build();
        pod.setStatus(
                new PodStatusBuilder()
                        .withPhase(KubernetesPod.PodPhase.Failed.name())
                        .withMessage("Pod Node didn't have enough resource")
                        .withReason("OutOfMemory")
                        .build());
        assertThat(new KubernetesPod(pod).isTerminated()).isTrue();
    }