### Question:
APIv1Controller { @GetMapping(value = "/metrics") public ResponseEntity<AlphaMetrics> metrics() { return ResponseEntity.ok(APIv1Impl.getMetrics()); }  @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 metricsTest() throws Exception { MetricsBean metricsBean = new MetricsBean(); metricsBean.doEventReceived(); metricsBean.doEventAccepted(); metricsBean.doEventAvgTime(5); metricsBean.doActorReceived(); metricsBean.doActorAccepted(); metricsBean.doActorAvgTime(5); metricsBean.doRepositoryReceived(); metricsBean.doRepositoryAccepted(); metricsBean.doRepositoryAvgTime(5); metricsBean.doCommitted(); metricsBean.doCompensated(); metricsBean.doSuspended(); metricsBean.doSagaBeginCounter(); metricsBean.doSagaEndCounter(); metricsBean.doSagaAvgTime(5); when(metricsService.metrics()).thenReturn(metricsBean); when(nodeStatus.getTypeEnum()).thenReturn(TypeEnum.MASTER); mockMvc.perform(get("/alpha/api/v1/metrics")) .andExpect(status().isOk()) .andExpect( MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.metrics.eventReceived").value(1)) .andExpect(jsonPath("$.metrics.eventAccepted").value(1)) .andExpect(jsonPath("$.metrics.eventRejected").value(0)) .andExpect(jsonPath("$.metrics.eventAvgTime").value(5.0)) .andExpect(jsonPath("$.metrics.actorReceived").value(1)) .andExpect(jsonPath("$.metrics.actorAccepted").value(1)) .andExpect(jsonPath("$.metrics.actorRejected").value(0)) .andExpect(jsonPath("$.metrics.actorAvgTime").value(5.0)) .andExpect(jsonPath("$.metrics.repositoryReceived").value(1)) .andExpect(jsonPath("$.metrics.repositoryAccepted").value(1)) .andExpect(jsonPath("$.metrics.repositoryRejected").value(0)) .andExpect(jsonPath("$.metrics.repositoryAvgTime").value(5.0)) .andExpect(jsonPath("$.metrics.sagaBeginCounter").value(1)) .andExpect(jsonPath("$.metrics.sagaEndCounter").value(1)) .andExpect(jsonPath("$.metrics.sagaAvgTime").value(5.0)) .andExpect(jsonPath("$.metrics.committed").value(1)) .andExpect(jsonPath("$.metrics.compensated").value(1)) .andExpect(jsonPath("$.metrics.suspended").value(1)) .andExpect(jsonPath("$.nodeType").value(TypeEnum.MASTER.name())) .andReturn(); }