@Test
public void testAlerting() throws Exception {

	Check check = createCheckCheckingMean(1, 5);
	when(alertingPlugin.getChecks()).thenReturn(Collections.singletonMap(check.getId(), check));
	checkMetrics();
	ArgumentCaptor<Alerter.AlertArguments> alertArguments = ArgumentCaptor.forClass(Alerter.AlertArguments.class);
	verify(alerter).alert(alertArguments.capture());
	final Incident incident = alertArguments.getValue().getIncident();
	assertEquals(check.getId(), incident.getCheckId());
	assertEquals("Test Timer", incident.getCheckName());
	assertEquals(CheckResult.Status.OK, incident.getOldStatus());
	assertEquals(CheckResult.Status.WARN, incident.getNewStatus());
	assertEquals(1, incident.getCheckResults().size());
	List<CheckResult> checkResults = incident.getCheckResults().iterator().next().getResults();
	assertEquals(2, checkResults.size());
	CheckResult result = checkResults.get(0);
	assertEquals("test_timer,signature=timer3 mean < 5.0 is false", result.getFailingExpression());
	assertEquals(6.0, result.getCurrentValue(), 0);
	assertEquals(CheckResult.Status.WARN, result.getStatus());
}