@Test public void getAll() { savedQueryController.getAll(false); verify(savedQueryService).getOwned(); }
@RequestMapping(method = RequestMethod.GET) public Set<SavedQuery> getAll( @RequestParam(name="shared", defaultValue = "false") boolean shared ) { if (shared) { final LinkedHashSet<SavedQuery> toReturn = new LinkedHashSet<>(service.getOwned()); final Set<Long> ids = toReturn.stream().map(SavedSearch::getId).collect(Collectors.toSet()); for(SavedQuery sharedQuery : service.getShared()) { if (!ids.contains(sharedQuery.getId())) { toReturn.add(sharedQuery); } } return toReturn; } return service.getOwned(); }
SavedQueryController { @RequestMapping(method = RequestMethod.GET) public Set<SavedQuery> getAll( @RequestParam(name="shared", defaultValue = "false") boolean shared ) { if (shared) { final LinkedHashSet<SavedQuery> toReturn = new LinkedHashSet<>(service.getOwned()); final Set<Long> ids = toReturn.stream().map(SavedSearch::getId).collect(Collectors.toSet()); for(SavedQuery sharedQuery : service.getShared()) { if (!ids.contains(sharedQuery.getId())) { toReturn.add(sharedQuery); } } return toReturn; } return service.getOwned(); } }
SavedQueryController { @RequestMapping(method = RequestMethod.GET) public Set<SavedQuery> getAll( @RequestParam(name="shared", defaultValue = "false") boolean shared ) { if (shared) { final LinkedHashSet<SavedQuery> toReturn = new LinkedHashSet<>(service.getOwned()); final Set<Long> ids = toReturn.stream().map(SavedSearch::getId).collect(Collectors.toSet()); for(SavedQuery sharedQuery : service.getShared()) { if (!ids.contains(sharedQuery.getId())) { toReturn.add(sharedQuery); } } return toReturn; } return service.getOwned(); } protected  SavedQueryController(
        final SavedSearchService<SavedQuery, SavedQuery.Builder> service,
        final DocumentsService<RQ, ?, ?, Q, D, E> documentsService,
        final FieldTextParser fieldTextParser,
        final ObjectFactory<? extends QueryRestrictionsBuilder<Q, S, ?>> queryRestrictionsBuilderFactory,
        final ObjectFactory<? extends QueryRequestBuilder<RQ, Q, ?>> queryRequestBuilderFactory
    ); }
SavedQueryController { @RequestMapping(method = RequestMethod.GET) public Set<SavedQuery> getAll( @RequestParam(name="shared", defaultValue = "false") boolean shared ) { if (shared) { final LinkedHashSet<SavedQuery> toReturn = new LinkedHashSet<>(service.getOwned()); final Set<Long> ids = toReturn.stream().map(SavedSearch::getId).collect(Collectors.toSet()); for(SavedQuery sharedQuery : service.getShared()) { if (!ids.contains(sharedQuery.getId())) { toReturn.add(sharedQuery); } } return toReturn; } return service.getOwned(); } protected  SavedQueryController(
        final SavedSearchService<SavedQuery, SavedQuery.Builder> service,
        final DocumentsService<RQ, ?, ?, Q, D, E> documentsService,
        final FieldTextParser fieldTextParser,
        final ObjectFactory<? extends QueryRestrictionsBuilder<Q, S, ?>> queryRestrictionsBuilderFactory,
        final ObjectFactory<? extends QueryRequestBuilder<RQ, Q, ?>> queryRequestBuilderFactory
    ); @RequestMapping(method = RequestMethod.GET) Set<SavedQuery> getAll(
        @RequestParam(name="shared", defaultValue = "false") boolean shared
    ); @RequestMapping(value = GET_SHARED, method = RequestMethod.GET) Set<SavedQuery> getShared(); @RequestMapping(method = RequestMethod.POST) SavedQuery create(
        @RequestBody final SavedQuery query
    ); @RequestMapping(value = "{id}", method = RequestMethod.PUT) SavedQuery update(
        @PathVariable("id") final long id,
        @RequestBody final SavedQuery query
    ); @RequestMapping(value = GET_SHARED + "/{id}", method = RequestMethod.PUT) SavedQuery updateShared(
            @PathVariable("id") final long id,
            @RequestBody final SavedQuery query
    ); @RequestMapping(value = "{id}", method = RequestMethod.DELETE) void delete(@SuppressWarnings("MVCPathVariableInspection") @PathVariable("id") final long id); @RequestMapping(value = NEW_RESULTS_PATH + "/{id}", method = RequestMethod.GET) int checkForNewQueryResults(@SuppressWarnings("MVCPathVariableInspection") @PathVariable("id") final long id); }
SavedQueryController { @RequestMapping(method = RequestMethod.GET) public Set<SavedQuery> getAll( @RequestParam(name="shared", defaultValue = "false") boolean shared ) { if (shared) { final LinkedHashSet<SavedQuery> toReturn = new LinkedHashSet<>(service.getOwned()); final Set<Long> ids = toReturn.stream().map(SavedSearch::getId).collect(Collectors.toSet()); for(SavedQuery sharedQuery : service.getShared()) { if (!ids.contains(sharedQuery.getId())) { toReturn.add(sharedQuery); } } return toReturn; } return service.getOwned(); } protected  SavedQueryController(
        final SavedSearchService<SavedQuery, SavedQuery.Builder> service,
        final DocumentsService<RQ, ?, ?, Q, D, E> documentsService,
        final FieldTextParser fieldTextParser,
        final ObjectFactory<? extends QueryRestrictionsBuilder<Q, S, ?>> queryRestrictionsBuilderFactory,
        final ObjectFactory<? extends QueryRequestBuilder<RQ, Q, ?>> queryRequestBuilderFactory
    ); @RequestMapping(method = RequestMethod.GET) Set<SavedQuery> getAll(
        @RequestParam(name="shared", defaultValue = "false") boolean shared
    ); @RequestMapping(value = GET_SHARED, method = RequestMethod.GET) Set<SavedQuery> getShared(); @RequestMapping(method = RequestMethod.POST) SavedQuery create(
        @RequestBody final SavedQuery query
    ); @RequestMapping(value = "{id}", method = RequestMethod.PUT) SavedQuery update(
        @PathVariable("id") final long id,
        @RequestBody final SavedQuery query
    ); @RequestMapping(value = GET_SHARED + "/{id}", method = RequestMethod.PUT) SavedQuery updateShared(
            @PathVariable("id") final long id,
            @RequestBody final SavedQuery query
    ); @RequestMapping(value = "{id}", method = RequestMethod.DELETE) void delete(@SuppressWarnings("MVCPathVariableInspection") @PathVariable("id") final long id); @RequestMapping(value = NEW_RESULTS_PATH + "/{id}", method = RequestMethod.GET) int checkForNewQueryResults(@SuppressWarnings("MVCPathVariableInspection") @PathVariable("id") final long id);  }