@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();
}