public List<Search> getAllForUser(SearchPermissions searchPermissions, Predicate<ViewDTO> viewReadPermission) {
        return dbService.streamAll()
                .filter(s -> hasReadPermissionFor(searchPermissions, viewReadPermission, s))
                .collect(Collectors.toList());
    }
@Test
    public void includesSearchesPermittedViaViewsInList() {
        final Search permittedSearch = mockSearchWithOwner("someone else");
        mockSearchWithOwner("someone else");
        final SearchUser searchUser = mock(SearchUser.class);

        final ViewDTO viewDTO = mock(ViewDTO.class);
        when(viewService.forSearch(permittedSearch.id())).thenReturn(ImmutableList.of(viewDTO));
        when(searchUser.canReadView(viewDTO)).thenReturn(true);

        List<Search> result = sut.getAllForUser(searchUser, searchUser::canReadView);

        assertThat(result).containsExactly(permittedSearch);
    }