use of ddf.metrics.reporting.internal.MetricsEndpointException in project ddf by codice.
the class MetricsEndpointTest method testGetMetricsGraphWithDateOffsetAndDates.
// NOTE: "expected" annotation does not work when test case extends XMLTestCase,
// hence the usage of the try/catch/fail approach for the expected exception
@Test
public // (expected = MetricsEndpointException.class)
void testGetMetricsGraphWithDateOffsetAndDates() throws Exception {
UriInfo uriInfo = createUriInfo();
MetricsEndpoint endpoint = getEndpoint();
endpoint.setMetricsDir(TEST_DIR);
try {
endpoint.getMetricsData("uptime", "png", "2013-03-25T06:00:00-07:00", "2013-03-25T07:10:00-07:00", "3600", "my label", "my title", uriInfo);
fail();
} catch (MetricsEndpointException e) {
}
}
use of ddf.metrics.reporting.internal.MetricsEndpointException in project ddf by codice.
the class MetricsEndpointTest method testGetMetricsGraphWithIOException.
// NOTE: "expected" annotation does not work when test case extends XMLTestCase,
// hence the usage of the try/catch/fail approach for the expected exception
@Test
public // (expected = MetricsEndpointException.class)
void testGetMetricsGraphWithIOException() throws Exception {
UriInfo uriInfo = createUriInfo();
RrdMetricsRetriever metricsRetriever = mock(RrdMetricsRetriever.class);
when(metricsRetriever.createGraph(anyString(), anyString(), anyLong(), anyLong(), anyString(), anyString())).thenThrow(IOException.class);
MetricsEndpoint endpoint = getEndpoint();
endpoint.setMetricsDir(TEST_DIR);
endpoint.setMetricsRetriever(metricsRetriever);
try {
endpoint.getMetricsData("uptime", "png", "2013-03-25T06:00:00-07:00", "2013-03-25T07:10:00-07:00", null, "my label", "my title", uriInfo);
fail();
} catch (MetricsEndpointException e) {
}
}
Aggregations