### Question:
FinalPodPhaseInfo { public static FinalPodPhaseInfo fromPodStatus(String podName, PodStatus status) { int exitCode = DEFAULT_EXIT_CODE; Optional<ContainerStatus> containerStatus = status.getContainerStatuses().stream() .filter(cs -> cs.getState() != null && cs.getState().getTerminated() != null) .findFirst(); if(containerStatus.isPresent()) exitCode = containerStatus.get().getState().getTerminated().getExitCode(); return new FinalPodPhaseInfo(podName, PodPhase.fromPodStatus(status), exitCode, status.getReason()); } FinalPodPhaseInfo(String podName, PodPhase podPhase, int exitCode, String reason); static FinalPodPhaseInfo fromPodStatus(String podName, PodStatus status); @Override String toString(); final PodPhase phase; final String name; final String reason; final Integer exitCode; }### Answer:
@Test(dataProvider = "testFromPodStatusProvider") public void testFromPodStatusProvider(PodStatus podStatus, final PodPhase EXPECTED_PHASE, final String EXPECTED_REASON, final Integer EXPECTED_EXIT_CODE) { final String NAME = "name"; FinalPodPhaseInfo info = FinalPodPhaseInfo.fromPodStatus(NAME, createPodStatus(EXPECTED_PHASE, EXPECTED_REASON, createStatus(EXPECTED_EXIT_CODE))); Assert.assertEquals(info.exitCode, EXPECTED_EXIT_CODE); Assert.assertEquals(info.name, NAME); Assert.assertEquals(info.phase, EXPECTED_PHASE); Assert.assertEquals(info.reason, EXPECTED_REASON); }