RateController { @GetMapping("/history") public List<DateValueDTO> findHistoricalValues(@RequestParam String fromcur, @RequestParam String tocur, @DateTimeFormat(iso = ISO.DATE_TIME) Instant startDate, @DateTimeFormat(iso = ISO.DATE_TIME) Instant endDate) { if (startDate == null) { startDate = rateService.getOldestRateDate(fromcur, tocur); } if (endDate == null) { endDate = rateService.getNewestRateDate(fromcur, tocur); } return dateValueMapper.toDateValueDto(rateService.getHistoricalValues(fromcur, tocur, startDate, endDate)); }  @GetMapping("/latest") List<RateDTO> findAllLatest(Principal p); @GetMapping(path = "/latest", params = { "fromcur", "tocur" }) RateDTO findLatest(@RequestParam String fromcur, @RequestParam String tocur); @GetMapping("/history") List<DateValueDTO> findHistoricalValues(@RequestParam String fromcur, @RequestParam String tocur, 
			@DateTimeFormat(iso = ISO.DATE_TIME) Instant startDate,
			@DateTimeFormat(iso = ISO.DATE_TIME) Instant endDate);  }
@Test public void testFindHistoricalValues() throws Exception { List<DateValue> histo = asList( new DateValueImpl().setDate(Instant.now()).setValue(123.789d), new DateValueImpl().setDate(Instant.now()).setValue(12d)); when(rateService.getHistoricalValues(eq("USD"), eq("EUR"), any(), any())).thenReturn(histo); mvc.perform(get("/api/rate/history") .param("fromcur", "USD") .param("tocur", "EUR")) .andExpect(jsonPath("$[0][0]").value(histo.get(0).getDate().toEpochMilli())) .andExpect(jsonPath("$[0][1]").value(histo.get(0).getValue())) .andExpect(jsonPath("$[1][0]").value(histo.get(1).getDate().toEpochMilli())) .andExpect(jsonPath("$[1][1]").value(histo.get(1).getValue())); }