DashboardController extends AbstractCrudController<Dashboard> { @RequestMapping( value = "/q/{query}", method = RequestMethod.GET ) public @ResponseBody DashboardSearchResult search( @PathVariable String query, @RequestParam( required = false ) Set<DashboardItemType> max, @RequestParam( required = false ) Integer count, @RequestParam( required = false ) Integer maxCount ) { return dashboardService.search( query, max, count, maxCount ); }  @RequestMapping( value = "/q/{query}", method = RequestMethod.GET ) @ResponseBody DashboardSearchResult search( @PathVariable String query,
        @RequestParam( required = false ) Set<DashboardItemType> max,
        @RequestParam( required = false ) Integer count,
        @RequestParam( required = false ) Integer maxCount ); @RequestMapping( value = "/q", method = RequestMethod.GET ) @ResponseBody DashboardSearchResult searchNoFilter(
        @RequestParam( required = false ) Set<DashboardItemType> max, @RequestParam( required = false ) Integer count,
        @RequestParam( required = false ) Integer maxCount ); @RequestMapping( value = "/{uid}/metadata", method = RequestMethod.GET ) ResponseEntity<RootNode> getDataSetWithDependencies( @PathVariable( "uid" ) String dashboardId, @RequestParam( required = false, defaultValue = "false" ) boolean download );  }
@Test public void verifyEndpointWithNoArgs() throws Exception { mockMvc.perform( get( ENDPOINT ) ).andExpect( status().isOk() ); verify( dashboardService ).search( null, null, null ); }
@Test public void verifyEndpointWithMaxArg() throws Exception { mockMvc.perform( get( ENDPOINT ).param( "max", "CHART" ) ).andExpect( status().isOk() ); verify( dashboardService ).search( Sets.newHashSet( DashboardItemType.CHART ), null, null ); }
@Test public void verifyEndpointWithAllArg() throws Exception { mockMvc.perform( get( ENDPOINT ) .param( "max", "CHART" ) .param( "count", "10" ) .param( "maxCount", "20" ) ) .andExpect( status().isOk() ); verify( dashboardService ).search( Sets.newHashSet( DashboardItemType.CHART ), 10, 20 ); }
@Test public void verifyEndpointWithSearchQueryWithNoArgs() throws Exception { mockMvc.perform( get( ENDPOINT + "/alfa" ) ).andExpect( status().isOk() ); verify( dashboardService ).search( "alfa" , null, null, null ); }
@Test public void verifyEndpointWithSearchQueryWithMaxArg() throws Exception { mockMvc.perform( get( ENDPOINT + "/alfa" ) .param( "max", "CHART" ) ) .andExpect( status().isOk() ); verify( dashboardService ).search( "alfa" , Sets.newHashSet( DashboardItemType.CHART ), null, null ); }
@Test public void verifyEndpointWithSearchQueryWithAllArg() throws Exception { mockMvc.perform( get( ENDPOINT + "/alfa" ) .param( "max", "CHART" ) .param( "count", "10" ) .param( "maxCount", "20" ) ) .andExpect( status().isOk() ); verify( dashboardService ).search( "alfa" , Sets.newHashSet( DashboardItemType.CHART ), 10, 20 ); }