### Question:
PluginMessageUtil { public static String transformLegacyToModernChannel(String name) { checkNotNull(name, "name"); if (name.indexOf(':') != -1) { return name; } switch (name) { case REGISTER_CHANNEL_LEGACY: return REGISTER_CHANNEL; case UNREGISTER_CHANNEL_LEGACY: return UNREGISTER_CHANNEL; case BRAND_CHANNEL_LEGACY: return BRAND_CHANNEL; case "BungeeCord": return "bungeecord:main"; default: String lower = name.toLowerCase(Locale.ROOT); return "legacy:" + INVALID_IDENTIFIER_REGEX.matcher(lower).replaceAll(""); } } private  PluginMessageUtil(); static boolean isMcBrand(PluginMessage message); static boolean isRegister(PluginMessage message); static boolean isUnregister(PluginMessage message); static boolean isLegacyRegister(PluginMessage message); static boolean isLegacyUnregister(PluginMessage message); static List<String> getChannels(PluginMessage message); static PluginMessage constructChannelsPacket(ProtocolVersion protocolVersion,
                                                      Collection<String> channels); static PluginMessage rewriteMinecraftBrand(PluginMessage message, ProxyVersion version); static String transformLegacyToModernChannel(String name);  }### Answer:
@Test void transformLegacyToModernChannelWorksWithModern() { assertEquals("minecraft:brand", PluginMessageUtil .transformLegacyToModernChannel("minecraft:brand")); assertEquals("velocity:test", PluginMessageUtil .transformLegacyToModernChannel("velocity:test")); }
@Test void transformLegacyToModernChannelRewritesSpecialCases() { assertEquals("minecraft:brand", PluginMessageUtil .transformLegacyToModernChannel("MC|Brand")); assertEquals("minecraft:register", PluginMessageUtil .transformLegacyToModernChannel("REGISTER")); assertEquals("minecraft:unregister", PluginMessageUtil .transformLegacyToModernChannel("UNREGISTER")); assertEquals("bungeecord:main", PluginMessageUtil .transformLegacyToModernChannel("BungeeCord")); }
@Test void transformLegacyToModernChannelRewritesGeneral() { assertEquals("legacy:example", PluginMessageUtil .transformLegacyToModernChannel("Example")); assertEquals("legacy:pskeepalive", PluginMessageUtil .transformLegacyToModernChannel("PS|KeepAlive")); }