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 throwsExceptionIfSearchIsNotFound() {
        final SearchUser searchUser = TestSearchUser.builder().build();

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

        assertThatExceptionOfType(NotFoundException.class)
                .isThrownBy(() -> this.searchExecutor.executeSync("search1", searchUser, ExecutionState.empty()))
                .withMessage("No search found with id <search1>.");
    }