Search in sources :

Example 1 with ReportableError

use of com.newrelic.agent.errors.ReportableError in project newrelic-java-agent by newrelic.

the class SpanErrorBuilderTest method shouldOmitClassForNoticeErrorStringAPI.

@Test
public void shouldOmitClassForNoticeErrorStringAPI() {
    when(mockAnalyzer.isReportable(anyInt(), ArgumentMatchers.<Throwable>any())).thenThrow(new AssertionError("should not have been called"));
    when(mockAnalyzer.isReportable(anyInt())).thenReturn(false);
    when(mockTracer.getException()).thenReturn(new ReportableError("will not be replaced"));
    when(mockTracer.wasExceptionSetByAPI()).thenReturn(true);
    when(mockReplacer.getMessage(ArgumentMatchers.<Throwable>any())).thenThrow(new AssertionError("should not have been called"));
    SpanError target = new SpanErrorBuilder(mockAnalyzer, mockReplacer).buildSpanError(mockTracer, false, 400, "fine", null);
    assertSpanError(target, null, null, "will not be replaced", false);
}
Also used : ReportableError(com.newrelic.agent.errors.ReportableError) SpanError(com.newrelic.agent.model.SpanError) Test(org.junit.Test)

Aggregations

ReportableError (com.newrelic.agent.errors.ReportableError)1 SpanError (com.newrelic.agent.model.SpanError)1 Test (org.junit.Test)1