@Test
public void matchRouteWithMultiEnvironments() {

    this.request.setRequestURI("/path/api/foo");
    this.request.setMethod(HttpMethod.GET.name());
    this.request.addHeader("host", "some-path.com");
    Map<String, ZuulRoute> routes = new LinkedHashMap<>();
    ZuulRoute route = new ZuulRoute("idFoo", "/path/api/foo", null, "my.dns.com.br", true, null, Collections.newSetFromMap(new ConcurrentHashMap<>()));
    routes.put("/path/api/foo", route);
    EnvironmentInfo environmentInfo = new EnvironmentInfo();
    environmentInfo.setId(1L);
    environmentInfo.setOutboundURL("https://some-path.com");
    environmentInfo.setVariables(new HashMap<>());
    Credential opGet = new Credential(HttpMethod.GET.name(), "/api/foo", "/path", "apiName", 10L, 88L, 10L, false);
    Credential opDelete = new Credential(HttpMethod.DELETE.name(), "/api/foo", "/path", "apiName", 10L, 88L, 10L, false);
    Mockito.when(routeLocator.getAtomicRoutes()).thenReturn(new AtomicReference<>(routes));
    Mockito.when(credentialRepository.findByPattern("/path/api/foo")).thenReturn(Lists.newArrayList(opGet, opDelete));
    Mockito.when(environmentInfoRepository.findByApiIdAndEnvironmentInboundURL(10L, "some-path.com")).thenReturn(environmentInfo);
    this.filter.run();
    assertEquals("/api/foo", this.ctx.get(REQUEST_URI_KEY));
    assertTrue(this.ctx.sendZuulResponse());
}