public Optional<Search> getForUser(String id, SearchUser searchUser) {
        final Optional<Search> search = dbService.get(id);

        search.ifPresent(s -> checkPermission(searchUser, s));

        return search;
    }
@Test
    public void throwsPermissionExceptionIfNeitherOwnedNorPermittedFromViews() {
        final Search search = mockSearchWithOwner("someone else");
        final SearchUser searchUser = mock(SearchUser.class);

        when(viewService.forSearch(anyString())).thenReturn(ImmutableList.of());

        assertThatExceptionOfType(PermissionException.class)
                .isThrownBy(() -> sut.getForUser(search.id(), searchUser));
    }