mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 03:13:41 +08:00
test(mcp): import Set/Map instead of inline FQN in identity-forward tests
Replace java.util.Set.of / java.util.Map.of inline fully-qualified calls with top-of-file imports per code style (test sources sync to the open-source repo).
This commit is contained in:
parent
758bdbb94b
commit
fcd682e4b4
@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
@ -61,10 +63,10 @@ class IdentityForwardingToolCallbackTest {
|
||||
void optInMatching() {
|
||||
McpIdentityForwardProperties p = new McpIdentityForwardProperties();
|
||||
assertThat(p.forwardsTo(42L, "svc")).isFalse(); // empty set
|
||||
p.setServers(java.util.Set.of("svc"));
|
||||
p.setServers(Set.of("svc"));
|
||||
assertThat(p.forwardsTo(42L, "svc")).isTrue(); // by name
|
||||
assertThat(p.forwardsTo(42L, "other")).isFalse();
|
||||
p.setServers(java.util.Set.of("42"));
|
||||
p.setServers(Set.of("42"));
|
||||
assertThat(p.forwardsTo(42L, "other")).isTrue(); // by id
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -93,7 +94,7 @@ class McpIdentityForwardServiceTest {
|
||||
void audienceResolution() {
|
||||
var p = new McpIdentityForwardProperties();
|
||||
assertThat(p.audienceFor(42L, "svc")).isEqualTo("svc"); // default = name
|
||||
p.getToken().setAudiences(java.util.Map.of("svc", "https://api.internal"));
|
||||
p.getToken().setAudiences(Map.of("svc", "https://api.internal"));
|
||||
assertThat(p.audienceFor(42L, "svc")).isEqualTo("https://api.internal");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user