### Question:
CallTree implements Recyclable { public CallTree() { } CallTree(); void set(@Nullable CallTree parent, StackFrame frame, long nanoTime); boolean isSuccessor(CallTree parent); @Nullable CallTree getNthParent(int n); void activation(TraceContext traceContext, long activationTimestamp); static CallTree.Root createRoot(ObjectPool<CallTree.Root> rootPool, byte[] traceContext, @Nullable String serviceName, long nanoTime); int getCount(); @Nullable StackFrame getFrame(); List<CallTree> getChildren(); boolean isLeaf(); @Nullable CallTree getLastChild(); boolean isEnded(); @Override String toString(); void recycle(ObjectPool<CallTree> pool); @Override void resetState(); void addMaybeChildId(long id); void addChildId(long id); boolean hasChildIds(); void recursiveGiveChildIdsTo(CallTree giveTo); int getDepth();  }### Answer:
@Test void testCallTree() throws Exception { TraceContext traceContext = TraceContext.with64BitId(MockTracer.create()); CallTree.Root root = CallTree.createRoot(NoopObjectPool.ofRecyclable(() -> new CallTree.Root(tracer)), traceContext.serialize(), traceContext.getServiceName(), 0); ObjectPool<CallTree> callTreePool = ListBasedObjectPool.ofRecyclable(new ArrayList<>(), Integer.MAX_VALUE, CallTree::new); root.addStackTrace(tracer, List.of(StackFrame.of("A", "a")), 0, callTreePool, 0); root.addStackTrace(tracer, List.of(StackFrame.of("A", "b"), StackFrame.of("A", "a")), TimeUnit.MILLISECONDS.toNanos(10), callTreePool, 0); root.addStackTrace(tracer, List.of(StackFrame.of("A", "b"), StackFrame.of("A", "a")), TimeUnit.MILLISECONDS.toNanos(20), callTreePool, 0); root.addStackTrace(tracer, List.of(StackFrame.of("A", "a")), TimeUnit.MILLISECONDS.toNanos(30), callTreePool, 0); root.end(callTreePool, 0); System.out.println(root); assertThat(root.getCount()).isEqualTo(4); assertThat(root.getDepth()).isEqualTo(0); assertThat(root.getChildren()).hasSize(1); CallTree a = root.getLastChild(); assertThat(a).isNotNull(); assertThat(a.getFrame().getMethodName()).isEqualTo("a"); assertThat(a.getCount()).isEqualTo(4); assertThat(a.getChildren()).hasSize(1); assertThat(a.getDepth()).isEqualTo(1); assertThat(a.isSuccessor(root)).isTrue(); CallTree b = a.getLastChild(); assertThat(b).isNotNull(); assertThat(b.getFrame().getMethodName()).isEqualTo("b"); assertThat(b.getCount()).isEqualTo(2); assertThat(b.getChildren()).isEmpty(); assertThat(b.getDepth()).isEqualTo(2); assertThat(b.isSuccessor(a)).isTrue(); assertThat(b.isSuccessor(root)).isTrue(); }