### Question:
ServerlessConfigurationManager { public String generateUrl(final Long configurationId, final String config) { final String configName = getConfigurationName(configurationId, config); final String apiHost = preferenceManager.getPreference(SystemPreferences.BASE_API_HOST_EXTERNAL); Assert.state(StringUtils.isNotBlank(apiHost), "API host is not specified"); return String.format("%s/serverless/%d/%s", StringUtils.stripEnd(apiHost, "/"), configurationId, configName); } ServerlessConfigurationManager(final RunConfigurationManager runConfigurationManager,
                                          final ConfigurationRunner configurationRunner,
                                          final AbstractRunConfigurationMapper runConfigurationMapper,
                                          final PipelineRunManager runManager,
                                          final PreferenceManager preferenceManager,
                                          final StopServerlessRunManager stopServerlessRunManager,
                                          final ObjectMapper objectMapper,
                                          final AuthManager authManager,
                                          @Value("${edge.internal.host:}") final String edgeInternalHost,
                                          @Value("${edge.internal.port}") final Integer edgeInternalPort); String run(final Long configurationId, final String configName, final HttpServletRequest request); String generateUrl(final Long configurationId, final String config);  }### Answer:
@Test public void shouldGenerateServerelessUrl() { final RunConfigurationEntry defaultEntry = runConfigurationEntry(TEST_NAME, true); final RunConfigurationEntry entry = runConfigurationEntry(ANOTHER_TEST_NAME, false); final RunConfiguration configuration = ObjectCreatorUtils.createConfiguration(TEST_NAME, null, null, null, Arrays.asList(entry, defaultEntry)); when(preferenceManager.getPreference(SystemPreferences.BASE_API_HOST_EXTERNAL)).thenReturn(TEST_URL); when(runConfigurationManager.load(any())).thenReturn(configuration); final String result = serverlessConfigurationManager.generateUrl(CONFIGURATION_ID, ANOTHER_TEST_NAME); assertEquals(TEST_URL + "serverless/" + CONFIGURATION_ID + "/" + ANOTHER_TEST_NAME, result); }
@Test public void shouldGenerateServerelessUrlFromDefaultConfiguration() { final RunConfigurationEntry defaultEntry = runConfigurationEntry(TEST_NAME, true); final RunConfigurationEntry entry = runConfigurationEntry(ANOTHER_TEST_NAME, false); final RunConfiguration configuration = ObjectCreatorUtils.createConfiguration(TEST_NAME, null, null, null, Arrays.asList(entry, defaultEntry)); when(preferenceManager.getPreference(SystemPreferences.BASE_API_HOST_EXTERNAL)).thenReturn(TEST_URL); when(runConfigurationManager.load(any())).thenReturn(configuration); final String result = serverlessConfigurationManager.generateUrl(CONFIGURATION_ID, null); assertEquals(TEST_URL + "serverless/" + CONFIGURATION_ID + "/" + TEST_NAME, result); }