@Test
public void shouldSendMailForGaugeAlert() throws Exception {

    // given
    setupForGauge(500);
    AlertingService alertingService = new AlertingService(configRepository,
            incidentRepository, aggregateRepository, gaugeValueRepository, traceRepository,
            rollupLevelService, mailService, httpClient, newLockSet(),
            newLockSet(),
            Clock.systemClock());
    // when
    alertingService.checkMetricAlert("", "", "", UPPER_BOUND_GAUGE_ALERT_CONFIG,
            UPPER_BOUND_GAUGE_ALERT_CONFIG.getCondition().getMetricCondition(), 120000);
    // then
    assertThat(mailService.getMessage()).isNotNull();
    assertThat(((String) mailService.getMessage().getContent()).trim())
            .isEqualTo("Average over the last 1 minute is greater than or equal to the alert"
                    + " threshold of 500 milliseconds per second.");
}