DependencyLinkV2SpanIterator implements Iterator<Span> { static @Nullable String emptyToNull(Record next, TableField<Record, String> field) { String result = next.getValue(field); return result != null && !"".equals(result) ? result : null; } DependencyLinkV2SpanIterator(PeekingIterator<Record> delegate, long traceIdHi, long traceIdLo); @Override boolean hasNext(); @Override Span next(); @Override void remove();  }
@Test public void emptyToNull() { DependencyLinkV2SpanIterator iterator = iterator( newRecord().values(traceIdHigh, traceId, parentId, spanId, "ca", TYPE_BOOLEAN, ""), newRecord().values(traceIdHigh, traceId, parentId, spanId, "cs", -1, ""), newRecord().values(traceIdHigh, traceId, parentId, spanId, "sa", TYPE_BOOLEAN, ""), newRecord().values(traceIdHigh, traceId, parentId, spanId, "sr", -1, "")); Span span = iterator.next(); assertThat(span.kind()).isNull(); assertThat(span.localEndpoint()).isNull(); assertThat(span.remoteEndpoint()).isNull(); }