SseUtil { public static boolean isValidTopicFilter(@Nullable String topicFilter) { return topicFilter == null || topicFilter.isEmpty() || topicFilter.matches(TOPIC_VALIDATE_PATTERN); }  static EventDTO buildDTO(final Event event); static OutboundSseEvent buildEvent(OutboundSseEvent.Builder eventBuilder, EventDTO event); static boolean isValidTopicFilter(@Nullable String topicFilter); static List<String> convertToRegex(@Nullable String topicFilter);  }
@Test public void testValidInvalidFilters() { assertThat(SseUtil.isValidTopicFilter("openhab/.*"), is(false)); assertThat(SseUtil.isValidTopicFilter("openhab/\\w*/"), is(false)); assertThat(SseUtil.isValidTopicFilter("sm.*/test/"), is(false)); assertThat(SseUtil.isValidTopicFilter("openhab.*"), is(false)); assertThat(SseUtil.isValidTopicFilter("openhab"), is(true)); assertThat(SseUtil.isValidTopicFilter(""), is(true)); assertThat(SseUtil.isValidTopicFilter(", openhabadded"), is(true)); assertThat(SseUtil.isValidTopicFilter("*added"), is(true)); assertThat(SseUtil.isValidTopicFilter("openhab/test/test:test:123/test"), is(true)); assertThat(SseUtil.isValidTopicFilter("openhab/test/test-test-123-test:test:123/test"), is(true)); }