Polish AbstractHttpServiceRegistrar.DefaultGroupSpec

Remove `DefaultGroupRegistry` since it's not really needed and polish
`DefaultGroupSpec` a little.
This commit is contained in:
Phillip Webb
2025-04-30 15:03:50 -07:00
committed by rstoyanchev
parent d2246162c3
commit 42e854e5ff
2 changed files with 39 additions and 56 deletions

View File

@@ -180,19 +180,12 @@ public class AnnotationHttpServiceRegistrarTests {
@Override
public GroupSpec forGroup(String name, ClientType clientType) {
return new TestGroupSpec(name, clientType);
return new TestGroupSpec(this.groupMap, name, clientType);
}
private class TestGroupSpec implements GroupSpec {
private final String groupName;
private final ClientType clientType;
public TestGroupSpec(String groupName, ClientType clientType) {
this.groupName = groupName;
this.clientType = clientType;
}
private record TestGroupSpec(Map<String, StubGroup> groupMap, String groupName,
ClientType clientType) implements GroupSpec {
@Override
public GroupSpec register(Class<?>... serviceTypes) {
@@ -213,7 +206,7 @@ public class AnnotationHttpServiceRegistrarTests {
}
private StubGroup getOrCreateGroup() {
return groupMap.computeIfAbsent(this.groupName, name -> new StubGroup(name, this.clientType));
return this.groupMap.computeIfAbsent(this.groupName, name -> new StubGroup(name, this.clientType));
}
}
}