### Question:
TraceCommonService { @VisibleForTesting static @Nullable String entriesToJson(List<Trace.Entry> entries) throws IOException { if (entries.isEmpty()) { return null; } StringBuilder sb = new StringBuilder(); JsonGenerator jg = jsonFactory.createGenerator(CharStreams.asWriter(sb)); try { writeEntries(jg, entries); } finally { jg.close(); } return sb.toString(); } TraceCommonService(TraceRepository traceRepository, LiveTraceRepository liveTraceRepository,
            ConfigRepository configRepository);   }### Answer:
@Test public void test() throws Exception { List<Trace.Entry> entries = Lists.newArrayList(); entries.add(Trace.Entry.newBuilder().setDepth(0).build()); entries.add(Trace.Entry.newBuilder().setDepth(1).build()); String json = TraceCommonService.entriesToJson(entries); assertThat(json).isEqualTo("[{\"startOffsetNanos\":0,\"durationNanos\":0,\"message\":\"\"," + "\"childEntries\":[{\"startOffsetNanos\":0,\"durationNanos\":0,\"message\":\"\"}]" + "}]"); }