use of com.newrelic.agent.bridge.NoOpToken in project newrelic-java-agent by newrelic.
the class FlyweightTracerTest method getTokenFromFlyweight.
@Trace(excludeFromTransactionTrace = true, leaf = true)
private void getTokenFromFlyweight() {
// When you are in a flyweight method you should not be allowed to get a token for async linking due to the
// fact that we have no real parent tracer to tie the token to. We can revisit this in the future if need be
// but it would require a significant number of changes to the agent
Token token = AgentBridge.getAgent().getTransaction().getToken();
Assert.assertNotNull(token);
Assert.assertFalse(token.isActive());
Assert.assertTrue(token instanceof NoOpToken);
}