IndicatorController { @RequestMapping("/{ric}/{name}/{date}") public String getIndicatorsAfter( @PathVariable String ric, @PathVariable String name, @PathVariable Long date) throws JsonProcessingException { logger.info("getIndicatorsAfter({}, {}, {}, {})", ric, name, date); List<IndicatorJson> indicators = elasticsearch.findIndicatorsByRicAndNameAndDateGreaterThan( ric, name, date); Object dto = new Object() { @JsonProperty("indicators") List<IndicatorJson> indicatorz = indicators; }; return json.writeValueAsString(dto); }  @PostConstruct void init(); @RequestMapping("/ping") PingResponse ping(); @RequestMapping("/{ric}") String getIndicators(
      @PathVariable String ric); @RequestMapping("/{ric}/{name}/{date}") String getIndicatorsAfter(
      @PathVariable String ric,
      @PathVariable String name,
      @PathVariable Long date);  }
@Test public void testGetIndicatorsAfter() throws Exception { given(elasticsearch .findIndicatorsByRicAndNameAndDateGreaterThan( Mockito.anyString(), Mockito.anyString(), Mockito.any(Long.class))) .willReturn(indicators); String expected = json.writeValueAsString(new Object() { @JsonProperty("indicators") List<IndicatorJson> indicatorz = indicators; }); long date = Instant.now().minus(1, ChronoUnit.MINUTES).toEpochMilli(); String restUri = String.format("%s/%s/%s/%s", TurbineCondenserConstants.REST_ROOT_INDICATORS, "ticker", "testName", date); mvc.perform(get(restUri).accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string(equalTo(expected))); }