use of org.springframework.cloud.gateway.route.RouteLocator in project spring-cloud-gateway by spring-cloud.
the class RouteBuilderTests method testASetOfRoutes.
@Test
public void testASetOfRoutes() {
RouteLocator routeLocator = this.routeLocatorBuilder.routes().route("test1", r -> r.host("*.somehost.org").and().path("/somepath").filters(f -> f.addRequestHeader("header1", "header-value-1")).uri("http://someuri")).route("test2", r -> r.host("*.somehost2.org").filters(f -> f.addResponseHeader("header-response-1", "header-response-1")).uri("https://httpbin.org:9090")).build();
StepVerifier.create(routeLocator.getRoutes()).expectNextMatches(r -> r.getId().equals("test1") && r.getFilters().size() == 1 && r.getUri().equals(URI.create("http://someuri:80"))).expectNextMatches(r -> r.getId().equals("test2") && r.getFilters().size() == 1 && r.getUri().equals(URI.create("https://httpbin.org:9090"))).expectComplete().verify();
}
Aggregations