use of org.opensearch.rest.RestHandler.Route in project OpenSearch by opensearch-project.
the class BaseRestHandlerTests method testReplaceRoutesMethod.
public void testReplaceRoutesMethod() throws Exception {
List<Route> routes = Arrays.asList(new Route(Method.GET, "/path/test"), new Route(Method.PUT, "/path2/test"));
List<ReplacedRoute> replacedRoutes = RestHandler.replaceRoutes(routes, "/prefix", "/deprecatedPrefix");
for (int i = 0; i < routes.size(); i++) {
assertEquals("/prefix" + routes.get(i).getPath(), replacedRoutes.get(i).getPath());
assertEquals(routes.get(i).getMethod(), replacedRoutes.get(i).getMethod());
assertEquals("/deprecatedPrefix" + routes.get(i).getPath(), replacedRoutes.get(i).getDeprecatedPath());
}
}
Aggregations