### Question:
SdxStartService { public FlowIdentifier triggerStartIfClusterNotRunning(SdxCluster cluster) { MDCBuilder.buildMdcContext(cluster); checkFreeipaRunning(cluster.getEnvCrn()); return sdxReactorFlowManager.triggerSdxStartFlow(cluster); }  FlowIdentifier triggerStartIfClusterNotRunning(SdxCluster cluster); void start(Long sdxId); void waitCloudbreakCluster(Long sdxId, PollingConfig pollingConfig);  }### Answer:
@Test public void testTriggerStart() { SdxCluster sdxCluster = sdxCluster(); sdxCluster.setEnvCrn("envCrn"); DescribeFreeIpaResponse freeIpaResponse = new DescribeFreeIpaResponse(); freeIpaResponse.setStatus(Status.AVAILABLE); when(freeipaService.describe("envCrn")).thenReturn(freeIpaResponse); underTest.triggerStartIfClusterNotRunning(sdxCluster); verify(sdxReactorFlowManager).triggerSdxStartFlow(sdxCluster); }
@Test public void testTriggerStartWhenFreeipaNull() { SdxCluster sdxCluster = sdxCluster(); underTest.triggerStartIfClusterNotRunning(sdxCluster); verify(sdxReactorFlowManager).triggerSdxStartFlow(sdxCluster); }
@Test public void testTriggerStartWhenFreeipaStopped() { SdxCluster sdxCluster = sdxCluster(); sdxCluster.setEnvCrn("envCrn"); DescribeFreeIpaResponse freeipa = new DescribeFreeIpaResponse(); freeipa.setStatus(Status.STOPPED); when(freeipaService.describe("envCrn")).thenReturn(freeipa); BadRequestException exception = Assertions.assertThrows(BadRequestException.class, () -> underTest.triggerStartIfClusterNotRunning(sdxCluster)); assertEquals("Freeipa should be in Available state but currently is " + freeipa.getStatus().name(), exception.getMessage()); }