### Question:
ThriftLogContext { public static OptionalLong getParentSpanId(){ RequestHeader header = threadLocal.get().getHeader(); return header.isSetParentSpanId()? OptionalLong.of(header.getParentSpanId()): OptionalLong.empty(); } private  ThriftLogContext(); static void newExecution(); static long getTraceId(); static void setTraceId(long traceId); static long getSpanId(); static void setSpanId(long spanId); static OptionalLong getParentSpanId(); static void setParentSpanId(OptionalLong parentSpanId); static Optional<Boolean> isSampled(); static void setSampled(Optional<Boolean> sampled); static RequestHeader getRequestHeader(); static void setRequestHeader(RequestHeader header); static void setParentRequestHeader(RequestHeader header); static String generateId(); static Optional<BooleanSupplier> getSampledSupplier(); static void setSampledSupplier(Optional<BooleanSupplier> sampledSupplier); static void setDefaultReporter(ThriftRequestReporter defaultRequestReporter); static ThriftRequestReporter getDefaultClientReporter(); static void setDefaultClientReporter(ThriftRequestReporter defaultClientReporter); static ThriftRequestReporter getDefaultServerReporter(); static void setDefaultServerReporter(ThriftRequestReporter defaultServerReporter); static String getClientAddress(); static void setClientAddress(String clientAddress); static final String TRACE_ID; static final String SPAN_ID; static final String PARENT_SPAN_ID; static final String SAMPLED; static final String CLIENT_ADDRESS; }### Answer:
@Test(groups = "unit") public void getParentSpanId() throws Exception { assertEquals(ThriftLogContext.getParentSpanId().isPresent(), false); long parentId = ThreadLocalRandom.current().nextLong(); MDC.put(ThriftLogContext.PARENT_SPAN_ID, Long.toHexString(parentId)); assertEquals(ThriftLogContext.getParentSpanId().getAsLong(), parentId); assertEquals(ThriftLogContext.getRequestHeader().getParentSpanId(), parentId); MDC.remove(ThriftLogContext.PARENT_SPAN_ID); assertEquals(ThriftLogContext.getParentSpanId().isPresent(), false); RequestHeader header = new RequestHeader(); header.setParentSpanId(0xDEAD); ThriftLogContext.setRequestHeader(header); assertEquals(ThriftLogContext.getParentSpanId().getAsLong(), 0xDEAD); }