### Question:
FreeIpaPollerService { public void startAttachedFreeipaInstances(Long envId, String envCrn) { executeFreeIpaOperationAndStartPolling(envCrn, freeIpaService::startFreeIpa, freeipaPollerProvider.startPoller(envId, envCrn), Status::isStartable); } FreeIpaPollerService(FreeIpaService freeIpaService, FreeIpaPollerProvider freeipaPollerProvider); void startAttachedFreeipaInstances(Long envId, String envCrn); void stopAttachedFreeipaInstances(Long envId, String envCrn); void waitForSynchronizeUsers(Long envId, String envCrn);  }### Answer:
@Test void testStartAttachedFreeipaInstancesWhenFreeipaAvailable() { DescribeFreeIpaResponse freeipaResponse = new DescribeFreeIpaResponse(); freeipaResponse.setStatus(Status.AVAILABLE); when(freeIpaService.describe(ENV_CRN)).thenReturn(Optional.of(freeipaResponse)); when(freeipaPollerProvider.startPoller(ENV_ID, ENV_CRN)).thenReturn(AttemptResults::justFinish); underTest.startAttachedFreeipaInstances(ENV_ID, ENV_CRN); verify(freeIpaService, times(0)).startFreeIpa(ENV_CRN); }
@Test void testStartAttachedFreeipaInstancesWhenFreeipaStopped() { DescribeFreeIpaResponse freeipaResponse = new DescribeFreeIpaResponse(); freeipaResponse.setStatus(Status.STOPPED); when(freeIpaService.describe(ENV_CRN)).thenReturn(Optional.of(freeipaResponse)); when(freeipaPollerProvider.startPoller(ENV_ID, ENV_CRN)).thenReturn(AttemptResults::justFinish); underTest.startAttachedFreeipaInstances(ENV_ID, ENV_CRN); verify(freeIpaService, times(1)).startFreeIpa(ENV_CRN); }