use of com.newrelic.agent.service.analytics.InsightsService in project newrelic-java-agent by newrelic.
the class InstrumentationTransactionTest method testExceptionInTransactionInitialization.
@Test
public void testExceptionInTransactionInitialization() {
ServiceManager serviceManager = Mockito.spy(ServiceFactory.getServiceManager());
InsightsService insightsService = Mockito.spy(serviceManager.getInsights());
Mockito.when(serviceManager.getInsights()).thenReturn(insightsService);
// Force throw an exception in the Transaction constructor
Mockito.doThrow(new RuntimeException()).when(insightsService).getTransactionInsights(Mockito.any(AgentConfig.class));
ServiceFactory.setServiceManager(serviceManager);
// Tracing the current test method doesn't allow us to use the
// mocked RuntimeException so we'll put it on a dummy method instead
doNothing();
}
Aggregations