package com.baiyue.gateway.config; import org.junit.jupiter.api.Test; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import static org.assertj.core.api.Assertions.assertThat; class OverseasLastlegRouteContractTest { @Test void platformDispatchPathIsForwardedToLastlegWithoutPrefixRewrite() throws IOException { try (InputStream input = getClass().getResourceAsStream("/application-overseas.yml")) { assertThat(input).isNotNull(); String yaml = new String(input.readAllBytes(), StandardCharsets.UTF_8); int routeStart = yaml.indexOf("- id: lastleg-service"); int routeEnd = yaml.indexOf("- id: warehouse-overseas-service", routeStart); assertThat(routeStart).isGreaterThanOrEqualTo(0); assertThat(routeEnd).isGreaterThan(routeStart); String route = yaml.substring(routeStart, routeEnd); assertThat(route).contains("uri: lb://lastleg-service") .contains("/api/platform/v1/last-leg/**") .doesNotContain("StripPrefix", "RewritePath"); } } }