InternalEnvironmentFactory { @VisibleForTesting Map<String, ServerConfig> normalizeServers(Map<String, ? extends ServerConfig> servers) { return servers .entrySet() .stream() .collect(Collectors.toMap(Entry::getKey, e -> normalizeServer(e.getValue()))); } InternalEnvironmentFactory(
      RecipeRetriever recipeRetriever, MachineConfigsValidator machinesValidator); T create(@Nullable final Environment sourceEnv);  }
@Test public void normalizeServersProtocols() throws InfrastructureException { ServerConfigImpl serverWithoutProtocol = new ServerConfigImpl("8080", "http", "/api", singletonMap("key", "value")); ServerConfigImpl udpServer = new ServerConfigImpl("8080/udp", "http", "/api", singletonMap("key", "value")); ServerConfigImpl normalizedServer = new ServerConfigImpl("8080/tcp", "http", "/api", singletonMap("key", "value")); Map<String, ServerConfig> servers = new HashMap<>(); servers.put("serverWithoutProtocol", serverWithoutProtocol); servers.put("udpServer", udpServer); Map<String, ServerConfig> normalizedServers = environmentFactory.normalizeServers(servers); assertEquals( normalizedServers, ImmutableMap.of("serverWithoutProtocol", normalizedServer, "udpServer", udpServer)); }