public SearchJob executeSync(String searchId, SearchUser searchUser, ExecutionState executionState) {
        return searchDomain.getForUser(searchId, searchUser)
                .map(s -> executeSync(s, searchUser, executionState))
                .orElseThrow(() -> new NotFoundException("No search found with id <" + searchId + ">."));
    }
@Test
    public void addsStreamsToSearchWithoutStreams() {
        final Search search = Search.builder()
                .queries(ImmutableSet.of(Query.builder().build()))
                .build();

        final SearchUser searchUser = TestSearchUser.builder()
                .withUser(testUser -> testUser.withUsername("frank-drebin"))
                .allowStream("somestream")
                .build();

        when(searchDomain.getForUser(eq("search1"), eq(searchUser))).thenReturn(Optional.of(search));

        final SearchJob searchJob = this.searchExecutor.executeSync("search1", searchUser, ExecutionState.empty());
        assertThat(searchJob.getSearch().queries())
                .are(new Condition<>(query -> query.usedStreamIds().equals(Collections.singleton("somestream")), "All accessible streams have been added"));
    }