### Question:
DomainStatusUpdater { public static Step createAvailableStep(String reason, Step next) { return new AvailableStep(reason, 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_availableStepUpdatesDomainWithAvailableTrueAndReason() { domain.setStatus(null); testSupport.runSteps(DomainStatusUpdater.createAvailableStep(reason, endStep)); assertThat(getRecordedDomain(), hasCondition(Available).withStatus("True").withReason(reason)); }
@Test public void whenDomainLacksAvailableCondition_availableStepUpdatesDomainWithAvailableTrueAndReason() { testSupport.runSteps(DomainStatusUpdater.createAvailableStep(reason, endStep)); assertThat(getRecordedDomain(), hasCondition(Available).withStatus("True").withReason(reason)); }
@Test public void whenDomainHasAvailableFalseCondition_availableStepUpdatesItWithTrueAndReason() { domain.getStatus().addCondition(new DomainCondition(Available).withStatus("False")); testSupport.runSteps(DomainStatusUpdater.createAvailableStep(reason, endStep)); assertThat(getRecordedDomain(), hasCondition(Available).withStatus("True").withReason(reason)); assertThat(getRecordedDomain().getStatus().getConditions(), hasSize(1)); }
@Test public void whenDomainHasProgressingCondition_availableStepRemovesIt() { domain.getStatus().addCondition(new DomainCondition(Progressing)); testSupport.runSteps(DomainStatusUpdater.createAvailableStep(reason, endStep)); assertThat(getRecordedDomain(), hasCondition(Available).withStatus("True").withReason(reason)); assertThat(getRecordedDomain(), not(hasCondition(Progressing))); }
@Test public void whenDomainHasFailedCondition_availableStepRemovesIt() { domain.getStatus().addCondition(new DomainCondition(Failed)); testSupport.runSteps(DomainStatusUpdater.createAvailableStep(reason, endStep)); assertThat(getRecordedDomain(), not(hasCondition(Failed))); }