MessagingRequestMatchers { public static <Req extends MessagingRequest> Matcher<Req> channelNameEquals(String channelName) { if (channelName == null) throw new NullPointerException("channelName == null"); if (channelName.isEmpty()) throw new NullPointerException("channelName is empty"); return new MessagingChannelNameEquals<>(channelName); }  static Matcher<Req> operationEquals(String operation); static Matcher<Req> channelKindEquals(String channelKind); static Matcher<Req> channelNameEquals(String channelName);  }
@Test public void channelNameEquals_matched() { when(request.channelName()).thenReturn("alerts"); assertThat(channelNameEquals("alerts").matches(request)).isTrue(); }
@Test public void channelNameEquals_unmatched_mixedCase() { when(request.channelName()).thenReturn("alerts"); assertThat(channelNameEquals("Alerts").matches(request)).isFalse(); }
@Test public void channelNameEquals_unmatched() { when(request.channelName()).thenReturn("complaints"); assertThat(channelNameEquals("alerts").matches(request)).isFalse(); }
@Test public void channelNameEquals_unmatched_null() { assertThat(channelNameEquals("alerts").matches(request)).isFalse(); }