2020import static org .junit .jupiter .api .Assertions .assertEquals ;
2121
2222import com .google .common .collect .ImmutableSet ;
23+ import com .velocitypowered .api .proxy .messages .ChannelIdentifier ;
2324import com .velocitypowered .api .proxy .messages .LegacyChannelIdentifier ;
2425import com .velocitypowered .api .proxy .messages .MinecraftChannelIdentifier ;
26+ import java .util .stream .Collectors ;
2527import org .junit .jupiter .api .Test ;
2628
2729class VelocityChannelRegistrarTest {
@@ -46,9 +48,9 @@ void register() {
4648 // Two channels cover the modern channel (velocity:test) and the legacy-mapped channel
4749 // (legacy:velocitytest). Make sure they're what we expect.
4850 assertEquals (ImmutableSet .of (MODERN .getId (), SIMPLE_LEGACY_REMAPPED ), registrar
49- .getModernChannelIds ());
51+ .getModernChannelIds (). stream (). map ( ChannelIdentifier :: getId ). collect ( Collectors . toSet ()) );
5052 assertEquals (ImmutableSet .of (SIMPLE_LEGACY .getId (), MODERN .getId ()), registrar
51- .getLegacyChannelIds ());
53+ .getLegacyChannelIds (). stream (). map ( ChannelIdentifier :: getId ). collect ( Collectors . toSet ()) );
5254 }
5355
5456 @ Test
@@ -57,9 +59,10 @@ void registerSpecialRewrite() {
5759 registrar .register (SPECIAL_REMAP_LEGACY , MODERN_SPECIAL_REMAP );
5860
5961 // This one, just one channel for the modern case.
60- assertEquals (ImmutableSet .of (MODERN_SPECIAL_REMAP .getId ()), registrar .getModernChannelIds ());
62+ assertEquals (ImmutableSet .of (MODERN_SPECIAL_REMAP .getId ()),
63+ registrar .getModernChannelIds ().stream ().map (ChannelIdentifier ::getId ).collect (Collectors .toSet ()));
6164 assertEquals (ImmutableSet .of (MODERN_SPECIAL_REMAP .getId (), SPECIAL_REMAP_LEGACY .getId ()),
62- registrar .getLegacyChannelIds ());
65+ registrar .getLegacyChannelIds (). stream (). map ( ChannelIdentifier :: getId ). collect ( Collectors . toSet ()) );
6366 }
6467
6568 @ Test
@@ -68,7 +71,9 @@ void unregister() {
6871 registrar .register (MODERN , SIMPLE_LEGACY );
6972 registrar .unregister (SIMPLE_LEGACY );
7073
71- assertEquals (ImmutableSet .of (MODERN .getId ()), registrar .getModernChannelIds ());
72- assertEquals (ImmutableSet .of (MODERN .getId ()), registrar .getLegacyChannelIds ());
74+ assertEquals (ImmutableSet .of (MODERN .getId ()),
75+ registrar .getModernChannelIds ().stream ().map (ChannelIdentifier ::getId ).collect (Collectors .toSet ()));;
76+ assertEquals (ImmutableSet .of (MODERN .getId ()),
77+ registrar .getLegacyChannelIds ().stream ().map (ChannelIdentifier ::getId ).collect (Collectors .toSet ()));
7378 }
7479}
0 commit comments