Files
baiyue-firstleg/gateway-overseas/src/test/java/com/baiyue/gateway/config/OverseasLastlegRouteContractTest.java
T
2026-08-21 10:43:25 +08:00

29 lines
1.1 KiB
Java

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");
}
}
}