ThingsSseRouteBuilder extends RouteDirectives implements SseRouteBuilder { private static List<String> getNamespaces(@Nullable final String namespacesParameter) { if (null != namespacesParameter) { return Arrays.asList(namespacesParameter.split(",")); } return Collections.emptyList(); } private  ThingsSseRouteBuilder(final ActorRef streamingActor,
            final StreamingConfig streamingConfig,
            final QueryFilterCriteriaFactory queryFilterCriteriaFactory,
            final ActorRef pubSubMediator); static ThingsSseRouteBuilder getInstance(final ActorRef streamingActor,
            final StreamingConfig streamingConfig,
            final ActorRef pubSubMediator); @Override SseRouteBuilder withAuthorizationEnforcer(final SseAuthorizationEnforcer enforcer); @Override ThingsSseRouteBuilder withEventSniffer(final EventSniffer<ServerSentEvent> eventSniffer); @Override SseRouteBuilder withSseConnectionSupervisor(final SseConnectionSupervisor sseConnectionSupervisor); @Override SseRouteBuilder withSignalEnrichmentProvider(@Nullable final GatewaySignalEnrichmentProvider provider); @Override SseRouteBuilder withProxyActor(@Nullable final ActorRef proxyActor); @SuppressWarnings("squid:S1172") // allow unused ctx-Param in order to have a consistent route-"interface" @Override Route build(final RequestContext ctx, final Supplier<CompletionStage<DittoHeaders>> dittoHeadersSupplier);  }
@Test public void searchWithQueryParameters() { final String filter = "not(exists(thingId))"; final String option = "sort(-policyId)"; final String namespaces = "a,b,c"; final String url = SEARCH_ROUTE + "?filter=" + filter + "&option=" + option + "&namespaces=" + namespaces; final TestRouteResult routeResult = underTest.run(HttpRequest.GET(url).addHeader(acceptHeader)); final CompletableFuture<Void> assertions = CompletableFuture.runAsync(() -> { routeResult.assertMediaType(MediaTypes.TEXT_EVENT_STREAM); routeResult.assertStatusCode(StatusCodes.OK); }); final StreamThings streamThings = proxyActor.expectMsgClass(StreamThings.class); replySourceRef(proxyActor, Source.lazily(Source::empty)); assertions.join(); assertThat(streamThings.getFilter()).contains(filter); assertThat(streamThings.getNamespaces()).contains(Set.of("a", "b", "c")); assertThat(streamThings.getSort()).contains("sort(-/policyId,+/thingId)"); }