@Test public void shouldThrowBadRequestExceptionGivenParentIsNotAvailable() { EnvironmentDto environmentDto = getEnvironmentDto(); environmentDto.setParentEnvironmentCrn(PARENT_ENV_CRN); when(environmentService.getByCrnAndAccountId(ENV_CRN, ACCOUNT_ID)).thenReturn(environmentDto); EnvironmentDto parentEnvironmentDto = new EnvironmentDto(); parentEnvironmentDto.setName("Parent-env-name"); parentEnvironmentDto.setStatus(EnvironmentStatus.ENV_STOPPED); when(environmentService.getByCrnAndAccountId(PARENT_ENV_CRN, ACCOUNT_ID)).thenReturn(parentEnvironmentDto); Assertions.assertThatThrownBy(() -> ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.startByCrn(ENV_CRN))) .isInstanceOf(BadRequestException.class) .hasMessageContaining(parentEnvironmentDto.getName()); }
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);  }