### Question:
DomainStatusUpdater { public static Step createFailedStep(CallResponse<?> callResponse, Step next) { FailureStatusSource failure = UnrecoverableErrorBuilder.fromFailedCall(callResponse); LOGGER.severe(MessageKeys.CALL_FAILED, failure.getMessage(), failure.getReason()); ApiException apiException = callResponse.getE(); if (apiException != null) { LOGGER.fine(MessageKeys.EXCEPTION, apiException); } return createFailedStep(failure.getReason(), failure.getMessage(), next); } private  DomainStatusUpdater(); static Step createStatusUpdateStep(Step next); static Step createProgressingStep(String reason, boolean isPreserveAvailable, Step next); static Step createProgressingStep(DomainPresenceInfo info, String reason, boolean isPreserveAvailable,
                                           Step next); static Step createAvailableStep(String reason, Step next); static Step createFailedStep(CallResponse<?> callResponse, Step next); static Step createFailedStep(String reason, String message, Step next); static Step createFailedStep(DomainPresenceInfo info, String reason, String message, Step next); static final String INSPECTING_DOMAIN_PROGRESS_REASON; static final String ADMIN_SERVER_STARTING_PROGRESS_REASON; static final String MANAGED_SERVERS_STARTING_PROGRESS_REASON; static final String SERVERS_READY_REASON; static final String ALL_STOPPED_AVAILABLE_REASON; static final String BAD_DOMAIN; static final String ERR_INTROSPECTOR; static final String BAD_TOPOLOGY; }### Answer:
@Test public void whenDomainLacksStatus_failedStepUpdatesDomainWithFailedTrueAndException() { domain.setStatus(null); testSupport.runSteps(DomainStatusUpdater.createFailedStep(failure, endStep)); assertThat( getRecordedDomain(), hasCondition(Failed).withStatus("True").withReason("Exception").withMessage(message)); }
@Test public void whenDomainLacksFailedCondition_failedStepUpdatesDomainWithFailedTrueAndException() { testSupport.runSteps(DomainStatusUpdater.createFailedStep(failure, endStep)); assertThat( getRecordedDomain(), hasCondition(Failed).withStatus("True").withReason("Exception").withMessage(message)); }
@Test public void whenDomainHasFailedFalseCondition_failedStepUpdatesItWithTrueAndException() { domain.getStatus().addCondition(new DomainCondition(Failed).withStatus("False")); testSupport.runSteps(DomainStatusUpdater.createFailedStep(failure, endStep)); assertThat( getRecordedDomain(), hasCondition(Failed).withStatus("True").withReason("Exception").withMessage(message)); assertThat(getRecordedDomain().getStatus().getConditions(), hasSize(1)); }
@Test public void whenDomainHasProgressingTrueCondition_failedStepRemovesIt() { domain.getStatus().addCondition(new DomainCondition(Progressing).withStatus("True")); testSupport.runSteps(DomainStatusUpdater.createFailedStep(failure, endStep)); assertThat(getRecordedDomain(), not(hasCondition(Progressing))); }
@Test public void failedStepWithFailureMessage_doesNotContainValidationWarnings() { info.addValidationWarning(validationWarning); testSupport.addToPacket(DOMAIN_TOPOLOGY, configSupport.createDomainConfig()); testSupport.runSteps(DomainStatusUpdater.createFailedStep(failure, endStep)); assertThat(getRecordedDomain().getStatus().getMessage(), not(containsString(validationWarning))); }