@Test public void testList() { final List<String> expectedNames = new ArrayList<>(); expectedNames.add("Filter1"); expectedNames.add("Filter2"); expectedNames.add("Filter3"); when(mockedManager.getAllFilterNames()).thenReturn(expectedNames); final JsonNode res = service.list(); for (int i = 0; i < res.size(); i++) { assertThat(res.get(i).textValue()).isEqualTo(expectedNames.get(i)); } }
@Get("/list") public JsonNode list() { final ArrayNode response = MAPPER.createArrayNode(); for (final String name : bloomFilterManager.getAllFilterNames()) { response.add(name); } return response; }
BloomFilterHttpService { @Get("/list") public JsonNode list() { final ArrayNode response = MAPPER.createArrayNode(); for (final String name : bloomFilterManager.getAllFilterNames()) { response.add(name); } return response; } }
BloomFilterHttpService { @Get("/list") public JsonNode list() { final ArrayNode response = MAPPER.createArrayNode(); for (final String name : bloomFilterManager.getAllFilterNames()) { response.add(name); } return response; } BloomFilterHttpService(BloomFilterManager<?, ? super ExpirableBloomFilterConfig> bloomFilterManager); }
BloomFilterHttpService { @Get("/list") public JsonNode list() { final ArrayNode response = MAPPER.createArrayNode(); for (final String name : bloomFilterManager.getAllFilterNames()) { response.add(name); } return response; } BloomFilterHttpService(BloomFilterManager<?, ? super ExpirableBloomFilterConfig> bloomFilterManager); @Put("/{name}") HttpResponse create(@Param String name,
                               @RequestObject JsonNode req); @Get("/{name}") JsonNode getFilterInfo(@Param String name); @Get("/list") JsonNode list(); @Post("/{name}/check") JsonNode check(@Param String name,
                          @RequestObject JsonNode req); @Post("/{name}/multi-check") JsonNode multiCheck(@Param String name,
                               @RequestObject JsonNode req); @Post("/{name}/check-and-set") JsonNode checkAndSet(@Param String name,
                                @RequestObject JsonNode req); @Post("/{name}/multi-check-and-set") JsonNode multiCheckAndSet(@Param String name,
                                     @RequestObject JsonNode req); @Delete("/{name}") HttpResponse remove(@Param String name); }
BloomFilterHttpService { @Get("/list") public JsonNode list() { final ArrayNode response = MAPPER.createArrayNode(); for (final String name : bloomFilterManager.getAllFilterNames()) { response.add(name); } return response; } BloomFilterHttpService(BloomFilterManager<?, ? super ExpirableBloomFilterConfig> bloomFilterManager); @Put("/{name}") HttpResponse create(@Param String name,
                               @RequestObject JsonNode req); @Get("/{name}") JsonNode getFilterInfo(@Param String name); @Get("/list") JsonNode list(); @Post("/{name}/check") JsonNode check(@Param String name,
                          @RequestObject JsonNode req); @Post("/{name}/multi-check") JsonNode multiCheck(@Param String name,
                               @RequestObject JsonNode req); @Post("/{name}/check-and-set") JsonNode checkAndSet(@Param String name,
                                @RequestObject JsonNode req); @Post("/{name}/multi-check-and-set") JsonNode multiCheckAndSet(@Param String name,
                                     @RequestObject JsonNode req); @Delete("/{name}") HttpResponse remove(@Param String name);  }