Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
29 lines
1.1 KiB
Java
29 lines
1.1 KiB
Java
package com.solvway.gateway;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.yaml.snakeyaml.Yaml;
|
|
|
|
import java.io.InputStream;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
/** mobile-api reaches services-system's /company/* endpoints through the gateway. */
|
|
class CompanyRouteTest {
|
|
|
|
@Test
|
|
@SuppressWarnings("unchecked")
|
|
void companyPathsRouteToServicesSystem() throws Exception {
|
|
try (InputStream in = getClass().getResourceAsStream("/application.yml")) {
|
|
Map<String, Object> yml = new Yaml().load(in);
|
|
Map<String, Object> gateway = (Map<String, Object>) ((Map<String, Object>) ((Map<String, Object>) yml.get("spring")).get("cloud")).get("gateway");
|
|
List<Map<String, Object>> routes = (List<Map<String, Object>>) gateway.get("routes");
|
|
assertThat(routes).anySatisfy(r -> {
|
|
assertThat(r.get("uri")).isEqualTo("http://${app.services.name.system}");
|
|
assertThat((List<String>) r.get("predicates")).contains("Path=/company/**");
|
|
});
|
|
}
|
|
}
|
|
}
|