jhutchison commented on a change in pull request #6493: URL: https://github.com/apache/geode/pull/6493#discussion_r635398954
########## File path: geode-apis-compatible-with-redis/src/test/java/org/apache/geode/redis/internal/pubsub/SubscriptionsJUnitTest.java ########## @@ -195,4 +197,70 @@ public void removeByClientAndPattern() { channelSubscriberOne, channelSubscriberTwo); } + + @Test + public void findChannelNames_shouldReturnAllChannelNames_whenCalledWithoutParameter() { + Subscriptions subject = new Subscriptions(); + + Channel channel = mock(Channel.class); + when(channel.closeFuture()).thenReturn(mock(ChannelFuture.class)); + Client client = new Client(channel); + ExecutionHandlerContext context = mock(ExecutionHandlerContext.class); + + Subscription subscriptionFoo = + new ChannelSubscription(client, "foo".getBytes(), context, subject); + + Subscription subscriptionBar = + new ChannelSubscription(client, "bar".getBytes(), context, subject); + + subject.add(subscriptionFoo); + subject.add(subscriptionBar); + + List<byte[]> result = subject.findChannelNames(); + + assertThat(result).containsExactlyInAnyOrder("foo".getBytes(), "bar".getBytes()); + } + + @Test + public void findChannelNames_shouldReturnOnlyMatchingChannelNames_whenCalledWithPattern() { + Subscriptions subject = new Subscriptions(); + byte[] pattern = "b*".getBytes(); + + Channel channel = mock(Channel.class); + when(channel.closeFuture()).thenReturn(mock(ChannelFuture.class)); + Client client = new Client(channel); + ExecutionHandlerContext context = mock(ExecutionHandlerContext.class); + + subject.add(new ChannelSubscription(client, "foo".getBytes(), context, subject)); + subject.add(new ChannelSubscription(client, "bar".getBytes(), context, subject)); + subject.add(new ChannelSubscription(client, "barbarella".getBytes(), context, subject)); Review comment: babar the elephant -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org