@Test public void shouldStopEnvWithOnlyStoppedChildren() { EnvironmentDto environmentDto = getEnvironmentDto(); when(environmentService.getByCrnAndAccountId(ENV_CRN, ACCOUNT_ID)).thenReturn(environmentDto); Environment childEnvironment = new Environment(); childEnvironment.setStatus(EnvironmentStatus.ENV_STOPPED); when(environmentService.findAllByAccountIdAndParentEnvIdAndArchivedIsFalse(ACCOUNT_ID, ENV_ID)).thenReturn(List.of(childEnvironment)); ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.stopByCrn(ENV_CRN)); verify(reactorFlowManager).triggerStopFlow(ENV_ID, ENV_NAME, USER_CRN); }
public void stopByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); stop(environment, accountId); }
EnvironmentStopService { public void stopByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); stop(environment, accountId); } }
EnvironmentStopService { public void stopByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); stop(environment, accountId); } EnvironmentStopService(EnvironmentReactorFlowManager reactorFlowManager,
            EnvironmentService environmentService); }
EnvironmentStopService { public void stopByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); stop(environment, accountId); } EnvironmentStopService(EnvironmentReactorFlowManager reactorFlowManager,
            EnvironmentService environmentService); void stopByCrn(String crn); void stopByName(String name); }
EnvironmentStopService { public void stopByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); stop(environment, accountId); } EnvironmentStopService(EnvironmentReactorFlowManager reactorFlowManager,
            EnvironmentService environmentService); void stopByCrn(String crn); void stopByName(String name);  }