File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ public Builder clear() {
205
205
id = null ;
206
206
parentId = null ;
207
207
timestamp = null ;
208
+ duration = null ;
208
209
if (annotations != null ) annotations .clear ();
209
210
if (binaryAnnotations != null ) binaryAnnotations .clear ();
210
211
debug = null ;
Original file line number Diff line number Diff line change 15
15
16
16
import java .io .ObjectInputStream ;
17
17
import java .io .ObjectOutputStream ;
18
+ import java .util .ArrayList ;
18
19
import java .util .Arrays ;
19
20
import okio .Buffer ;
20
21
import okio .ByteString ;
@@ -64,6 +65,18 @@ public void spanNamesLowercase() {
64
65
.isEqualTo ("get" );
65
66
}
66
67
68
+ @ Test
69
+ public void clearBuilder_retainsEmptyCollections () {
70
+ Span .Builder builder = TestObjects .TRACE .get (1 ).toBuilder ();
71
+
72
+ // clear should set everything null, but retain empty collections
73
+ Span .Builder expected = Span .builder ();
74
+ expected .annotations = new ArrayList <>();
75
+ expected .binaryAnnotations = new ArrayList <>();
76
+ assertThat (builder .clear ())
77
+ .isEqualToComparingFieldByField (expected );
78
+ }
79
+
67
80
@ Test
68
81
public void mergeWhenBinaryAnnotationsSentSeparately () {
69
82
Span part1 = Span .builder ()
You can’t perform that action at this time.
0 commit comments