TraceIdContext extends SamplingFlags { public Builder toBuilder() { Builder result = new Builder(); result.flags = flags; result.traceIdHigh = traceIdHigh; result.traceId = traceId; return result; } TraceIdContext(int flags, long traceIdHigh, long traceId); static Builder newBuilder(); long traceIdHigh(); long traceId(); String traceIdString(); Builder toBuilder(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void canUsePrimitiveOverloads_true() { TraceIdContext primitives = base.toBuilder() .sampled(true) .debug(true) .build(); TraceIdContext objects = base.toBuilder() .sampled(Boolean.TRUE) .debug(Boolean.TRUE) .build(); assertThat(primitives) .isEqualToComparingFieldByField(objects); assertThat(primitives.debug()) .isTrue(); assertThat(primitives.sampled()) .isTrue(); }
@Test public void canUsePrimitiveOverloads_false() { base = base.toBuilder().debug(true).build(); TraceIdContext primitives = base.toBuilder() .sampled(false) .debug(false) .build(); TraceIdContext objects = base.toBuilder() .sampled(Boolean.FALSE) .debug(Boolean.FALSE) .build(); assertThat(primitives) .isEqualToComparingFieldByField(objects); assertThat(primitives.debug()) .isFalse(); assertThat(primitives.sampled()) .isFalse(); }
@Test public void canSetSampledNull() { base = base.toBuilder().sampled(true).build(); TraceIdContext objects = base.toBuilder().sampled(null).build(); assertThat(objects.debug()) .isFalse(); assertThat(objects.sampled()) .isNull(); }