use of com.microsoft.applicationinsights.agent.internal.exporter.models.TelemetryItem in project ApplicationInsights-Java by microsoft.
the class QuickPulseDataCollectorTests method exceptionTelemetryIsCounted.
@Test
void exceptionTelemetryIsCounted() {
TelemetryClient telemetryClient = TelemetryClient.createForTest();
telemetryClient.setInstrumentationKey(FAKE_INSTRUMENTATION_KEY);
QuickPulseDataCollector.INSTANCE.setQuickPulseStatus(QuickPulseStatus.QP_IS_ON);
QuickPulseDataCollector.INSTANCE.enable(telemetryClient);
TelemetryItem telemetry = createExceptionTelemetry(new Exception());
telemetry.setInstrumentationKey(FAKE_INSTRUMENTATION_KEY);
QuickPulseDataCollector.INSTANCE.add(telemetry);
FinalCounters counters = QuickPulseDataCollector.INSTANCE.peek();
assertThat(counters.exceptions).isEqualTo(1);
telemetry = createExceptionTelemetry(new Exception());
telemetry.setInstrumentationKey(FAKE_INSTRUMENTATION_KEY);
QuickPulseDataCollector.INSTANCE.add(telemetry);
counters = QuickPulseDataCollector.INSTANCE.getAndRestart();
assertThat(counters.exceptions).isEqualTo(2);
assertCountersReset(QuickPulseDataCollector.INSTANCE.peek());
}
Aggregations