@Test
public void shouldSendMailForTransactionAlert() throws Exception {

    // given
    setupForTransaction(1000000);
    AlertingService alertingService = new AlertingService(configRepository,
            incidentRepository, aggregateRepository, gaugeValueRepository, traceRepository,
            rollupLevelService, mailService, httpClient, newLockSet(),
            newLockSet(),
            Clock.systemClock());
    // when
    alertingService.checkMetricAlert("", "", "", TRANSACTION_X_PERCENTILE_ALERT_CONFIG,
            TRANSACTION_X_PERCENTILE_ALERT_CONFIG.getCondition().getMetricCondition(), 120000);
    // then
    assertThat(mailService.getMessage()).isNotNull();
    assertThat(((String) mailService.getMessage().getContent()).trim())
            .isEqualTo("95th percentile over the last 1 minute is greater than or equal to the"
                    + " alert threshold of 1 millisecond.");
}