### Question:
DefaultClientIdRegistry implements ClientIdRegistry { @Override public boolean unregister(String clientStreamId, ConnectionType type) { Map<String, String> connectionTypeMap = clientIdMapPerType.getOrDefault(type, Collections.emptyMap()); String clientId = connectionTypeMap.remove(clientStreamId); return clientId != null; }  @Override boolean register(String clientStreamId, String clientId, ConnectionType type); @Override boolean unregister(String clientStreamId, ConnectionType type); @Override String clientId(String clientStreamId); @Override Set<String> streamIdsFor(String clientId, ConnectionType type); @Override void printOn(Media media); @EventListener void on(ApplicationConnected event); @EventListener void on(ApplicationDisconnected event); @EventListener void on(SubscribeCommand event); @EventListener void on(CommandHandlerDisconnected event); @EventListener void on(SubscribeQuery event); @EventListener void on(QueryHandlerDisconnected event);  }### Answer:
@Test public void unregister() { testSubject.register("clientStreamId", "clientId", ClientIdRegistry.ConnectionType.COMMAND); testSubject.unregister("clientStreamId", ClientIdRegistry.ConnectionType.COMMAND); try { testSubject.clientId("clientStreamId"); fail("Should not get the clientId"); } catch (IllegalStateException illegalStateException) { } try { testSubject.streamIdFor("clientId", ClientIdRegistry.ConnectionType.COMMAND); fail("should not find command stream"); } catch (IllegalStateException illegalStateException) { } testSubject.unregister("clientStreamId", ClientIdRegistry.ConnectionType.COMMAND); }