@Test
public void when_anEntityIsGiven_then_ContextIsReturned() {

  when(segment.getParentSegment()).thenReturn(segment);
  when(segment.getTraceId()).thenReturn(xrayTraceId);
  when(segment.getId()).thenReturn(SEGMENT_ID);
  when(segment.isSampled()).thenReturn(true);
  when(segment.getParentId()).thenReturn(SEGMENT_ID);
  assertEquals(context, ContextUtils.entityToSpanContext(segment));
}