SpanParser { protected static List<TimestampedAnnotation> convertToTimestampedAnnotationsList( List<JsonDeserializationResult> jdrList ) { if (jdrList == null || jdrList.isEmpty()) { return null; } List<TimestampedAnnotation> annotationList = new ArrayList<>(jdrList.size()); for (JsonDeserializationResult jdr : jdrList) { long timestamp = Long.parseLong(jdr.levelOneKeyValuePairs.get(ANNOTATION_SUBOBJECT_TIMESTAMP_FIELD)); String value = jdr.levelOneKeyValuePairs.get(ANNOTATION_SUBOBJECT_VALUE_FIELD); annotationList.add(new TimestampedAnnotation(timestamp, value)); } return annotationList; } protected  SpanParser(); static String convertSpanToJSON(Span span); static Span fromJSON(String json); static String convertSpanToKeyValueFormat(Span span); static Span fromKeyValueString(String keyValueStr); static String escapeJson(String orig); static String unescapeJson(String escaped); static final String TRACE_ID_FIELD; static final String PARENT_SPAN_ID_FIELD; static final String SPAN_ID_FIELD; static final String SPAN_NAME_FIELD; static final String SAMPLEABLE_FIELD; static final String USER_ID_FIELD; static final String SPAN_PURPOSE_FIELD; static final String START_TIME_EPOCH_MICROS_FIELD; static final String DURATION_NANOS_FIELD; static final String TAGS_FIELD; static final String ANNOTATIONS_LIST_FIELD; static final String ANNOTATION_SUBOBJECT_TIMESTAMP_FIELD; static final String ANNOTATION_SUBOBJECT_VALUE_FIELD; static final String KEY_VALUE_TAG_PREFIX; static final String KEY_VALUE_TIMESTAMPED_ANNOTATION_PREFIX; }
@DataProvider(value = { "true", "false" }) @Test public void convertToTimestampedAnnotationsList_returns_null_if_passed_null_or_empty(boolean isNull) { List<JsonDeserializationResult> jdrList = (isNull) ? null : Collections.emptyList(); List<TimestampedAnnotation> result = SpanParser.convertToTimestampedAnnotationsList(jdrList); assertThat(result).isNull(); }