ConfigMapServerResolver extends AbstractServerResolver { @Override public Map<String, ServerImpl> resolveExternalServers(String machineName) { Map<String, ServerImpl> serverMap = new HashMap<>(); serverMap.putAll(nativeServerResolver.resolveExternalServers(machineName)); serverMap.putAll( configMaps .get(machineName) .stream() .map(this::fillGatewayServers) .flatMap(m -> m.entrySet().stream()) .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (s1, s2) -> s2))); return serverMap; } ConfigMapServerResolver(
      Iterable<Service> services,
      Iterable<ConfigMap> configMaps,
      String cheHost,
      ServerResolver nativeServerResolver); @Override Map<String, ServerImpl> resolveExternalServers(String machineName);  }
@Test public void shouldIncludeServersFromNativeResolver() { ServerImpl server = new ServerImpl("server", ServerStatus.UNKNOWN, emptyMap()); when(nativeServerResolver.resolveExternalServers("test")) .thenReturn(singletonMap("s1", server)); ConfigMapServerResolver serverResolver = new ConfigMapServerResolver(emptyList(), emptyList(), "che.host", nativeServerResolver); Map<String, ServerImpl> resolvedServers = serverResolver.resolve("test"); assertTrue(resolvedServers.containsKey("s1")); assertEquals(resolvedServers.get("s1"), server); }