@Test public void shouldStartEnvironmentGivenParentIsAvailable() { EnvironmentDto environmentDto = getEnvironmentDto(); environmentDto.setParentEnvironmentCrn(PARENT_ENV_CRN); when(environmentService.getByCrnAndAccountId(ENV_CRN, ACCOUNT_ID)).thenReturn(environmentDto); EnvironmentDto parentEnvironmentDto = new EnvironmentDto(); parentEnvironmentDto.setStatus(EnvironmentStatus.AVAILABLE); when(environmentService.getByCrnAndAccountId(PARENT_ENV_CRN, ACCOUNT_ID)).thenReturn(parentEnvironmentDto); ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.startByCrn(ENV_CRN)); verify(reactorFlowManager).triggerStartFlow(ENV_ID, ENV_NAME, USER_CRN); }
public void startByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); start(environment, accountId); }
EnvironmentStartService { public void startByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); start(environment, accountId); } }
EnvironmentStartService { public void startByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); start(environment, accountId); } EnvironmentStartService(EnvironmentReactorFlowManager reactorFlowManager,
            EnvironmentService environmentService); }
EnvironmentStartService { public void startByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); start(environment, accountId); } EnvironmentStartService(EnvironmentReactorFlowManager reactorFlowManager,
            EnvironmentService environmentService); void startByCrn(String crn); void startByName(String name); }
EnvironmentStartService { public void startByCrn(String crn) { String accountId = ThreadBasedUserCrnProvider.getAccountId(); EnvironmentDto environment = environmentService.getByCrnAndAccountId(crn, accountId); start(environment, accountId); } EnvironmentStartService(EnvironmentReactorFlowManager reactorFlowManager,
            EnvironmentService environmentService); void startByCrn(String crn); void startByName(String name);  }