### Question:
ThriftLogContext { public static long getSpanId(){ return threadLocal.get().getHeader().getSpanId(); } 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 getSpanId() throws Exception { long spanId = ThriftLogContext.getSpanId(); assertEquals(ThriftLogContext.getSpanId(), spanId); assertTrue(spanId != 0); spanId = ThreadLocalRandom.current().nextLong(); MDC.put(ThriftLogContext.SPAN_ID, Long.toHexString(spanId)); assertEquals(ThriftLogContext.getSpanId(), spanId); MDC.remove(ThriftLogContext.SPAN_ID); assertNotEquals(ThriftLogContext.getSpanId(), spanId); RequestHeader header = new RequestHeader(); header.setSpanId(0xDEAD); ThriftLogContext.setRequestHeader(header); assertEquals(ThriftLogContext.getSpanId(), 0xDEAD); assertEquals(MDC.get(ThriftLogContext.SPAN_ID), "dead"); header = new RequestHeader(); ThriftLogContext.setRequestHeader(header); assertNotEquals(MDC.get(ThriftLogContext.SPAN_ID), "dead"); assertNotEquals(ThriftLogContext.getSpanId(), 0); }