### Question:
APIv1Controller { @GetMapping(value = "/transaction/statistics") public ResponseEntity<Map<String,Long>> getTransactionStatistics() { return ResponseEntity.ok(APIv1Impl.getTransactionStatistics()); }  @GetMapping(value = "/metrics") ResponseEntity<AlphaMetrics> metrics(); @GetMapping(value = "/transaction/{globalTxId}") ResponseEntity<GlobalTransaction> getTransactionByGlobalTxId(@PathVariable String globalTxId); @GetMapping(value = "/transaction") ResponseEntity<PagingGlobalTransactions> getTransactions(@RequestParam(value = "page", required = false, defaultValue = "0") int page,
      @RequestParam(value = "size", required = false, defaultValue = "50") int size); @GetMapping(value = "/transaction/statistics") ResponseEntity<Map<String,Long>> getTransactionStatistics(); @GetMapping(value = "/transaction/slow") ResponseEntity<List<GlobalTransaction>> getSlowTransactions(@RequestParam(name="size", defaultValue = "10") int size);  }### Answer:
@Test public void transactionStatisticsTest() throws Exception { Map<String, Long> statistics = new HashMap<>(); statistics.put("COMMITTED", 1l); statistics.put("SUSPENDED", 2l); statistics.put("COMPENSATED", 3l); when(transactionRepository.getTransactionStatistics()).thenReturn(statistics); mockMvc.perform(get("/alpha/api/v1/transaction/statistics")) .andExpect(status().isOk()) .andExpect( MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.COMMITTED").value(statistics.get("COMMITTED"))) .andExpect(jsonPath("$.SUSPENDED").value(statistics.get("SUSPENDED"))) .andExpect(jsonPath("$.COMPENSATED").value(statistics.get("COMPENSATED"))) .andReturn(); }