@Test(expected = NullPointerException.class) public void createNewZipkinRequestUUID_WhenCougarUUIDIsNull_ShouldThrowNPE() { victim.createNewZipkinRequestUUID(null, traceId, spanId, parentSpanId, sampled, flags, port); }
public ZipkinRequestUUID createNewZipkinRequestUUID(@Nonnull RequestUUID cougarUuid, @Nullable String traceId, @Nullable String spanId, @Nullable String parentSpanId, @Nullable String sampled, @Nullable String flags, int port) { Objects.requireNonNull(cougarUuid); if (Boolean.FALSE.equals(ZipkinKeys.sampledToBoolean(sampled))) { return new ZipkinRequestUUIDImpl(cougarUuid, null); } ZipkinDataBuilder zipkinDataBuilder; if (traceId != null && spanId != null) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(hexUnsignedStringToLong(traceId)) .spanId(hexUnsignedStringToLong(spanId)) .parentSpanId(parentSpanId == null ? null : hexUnsignedStringToLong(parentSpanId)) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { if (shouldTrace()) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(getRandomLong()) .spanId(getRandomLong()) .parentSpanId(null) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { zipkinDataBuilder = null; } } return new ZipkinRequestUUIDImpl(cougarUuid, zipkinDataBuilder); }
ZipkinManager { public ZipkinRequestUUID createNewZipkinRequestUUID(@Nonnull RequestUUID cougarUuid, @Nullable String traceId, @Nullable String spanId, @Nullable String parentSpanId, @Nullable String sampled, @Nullable String flags, int port) { Objects.requireNonNull(cougarUuid); if (Boolean.FALSE.equals(ZipkinKeys.sampledToBoolean(sampled))) { return new ZipkinRequestUUIDImpl(cougarUuid, null); } ZipkinDataBuilder zipkinDataBuilder; if (traceId != null && spanId != null) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(hexUnsignedStringToLong(traceId)) .spanId(hexUnsignedStringToLong(spanId)) .parentSpanId(parentSpanId == null ? null : hexUnsignedStringToLong(parentSpanId)) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { if (shouldTrace()) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(getRandomLong()) .spanId(getRandomLong()) .parentSpanId(null) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { zipkinDataBuilder = null; } } return new ZipkinRequestUUIDImpl(cougarUuid, zipkinDataBuilder); } }
ZipkinManager { public ZipkinRequestUUID createNewZipkinRequestUUID(@Nonnull RequestUUID cougarUuid, @Nullable String traceId, @Nullable String spanId, @Nullable String parentSpanId, @Nullable String sampled, @Nullable String flags, int port) { Objects.requireNonNull(cougarUuid); if (Boolean.FALSE.equals(ZipkinKeys.sampledToBoolean(sampled))) { return new ZipkinRequestUUIDImpl(cougarUuid, null); } ZipkinDataBuilder zipkinDataBuilder; if (traceId != null && spanId != null) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(hexUnsignedStringToLong(traceId)) .spanId(hexUnsignedStringToLong(spanId)) .parentSpanId(parentSpanId == null ? null : hexUnsignedStringToLong(parentSpanId)) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { if (shouldTrace()) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(getRandomLong()) .spanId(getRandomLong()) .parentSpanId(null) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { zipkinDataBuilder = null; } } return new ZipkinRequestUUIDImpl(cougarUuid, zipkinDataBuilder); }  }
ZipkinManager { public ZipkinRequestUUID createNewZipkinRequestUUID(@Nonnull RequestUUID cougarUuid, @Nullable String traceId, @Nullable String spanId, @Nullable String parentSpanId, @Nullable String sampled, @Nullable String flags, int port) { Objects.requireNonNull(cougarUuid); if (Boolean.FALSE.equals(ZipkinKeys.sampledToBoolean(sampled))) { return new ZipkinRequestUUIDImpl(cougarUuid, null); } ZipkinDataBuilder zipkinDataBuilder; if (traceId != null && spanId != null) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(hexUnsignedStringToLong(traceId)) .spanId(hexUnsignedStringToLong(spanId)) .parentSpanId(parentSpanId == null ? null : hexUnsignedStringToLong(parentSpanId)) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { if (shouldTrace()) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(getRandomLong()) .spanId(getRandomLong()) .parentSpanId(null) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { zipkinDataBuilder = null; } } return new ZipkinRequestUUIDImpl(cougarUuid, zipkinDataBuilder); }  boolean shouldTrace(); @ManagedAttribute int getSamplingLevel(); @ManagedAttribute void setSamplingLevel(int samplingLevel); ZipkinRequestUUID createNewZipkinRequestUUID(@Nonnull RequestUUID cougarUuid, @Nullable String traceId,
                                                        @Nullable String spanId, @Nullable String parentSpanId,
                                                        @Nullable String sampled, @Nullable String flags, int port); static long getRandomLong(); static long hexUnsignedStringToLong(@Nonnull String hexValue); }
ZipkinManager { public ZipkinRequestUUID createNewZipkinRequestUUID(@Nonnull RequestUUID cougarUuid, @Nullable String traceId, @Nullable String spanId, @Nullable String parentSpanId, @Nullable String sampled, @Nullable String flags, int port) { Objects.requireNonNull(cougarUuid); if (Boolean.FALSE.equals(ZipkinKeys.sampledToBoolean(sampled))) { return new ZipkinRequestUUIDImpl(cougarUuid, null); } ZipkinDataBuilder zipkinDataBuilder; if (traceId != null && spanId != null) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(hexUnsignedStringToLong(traceId)) .spanId(hexUnsignedStringToLong(spanId)) .parentSpanId(parentSpanId == null ? null : hexUnsignedStringToLong(parentSpanId)) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { if (shouldTrace()) { zipkinDataBuilder = new ZipkinDataImpl.Builder() .traceId(getRandomLong()) .spanId(getRandomLong()) .parentSpanId(null) .flags(flags == null ? null : Long.valueOf(flags)) .port((short) port); } else { zipkinDataBuilder = null; } } return new ZipkinRequestUUIDImpl(cougarUuid, zipkinDataBuilder); }  boolean shouldTrace(); @ManagedAttribute int getSamplingLevel(); @ManagedAttribute void setSamplingLevel(int samplingLevel); ZipkinRequestUUID createNewZipkinRequestUUID(@Nonnull RequestUUID cougarUuid, @Nullable String traceId,
                                                        @Nullable String spanId, @Nullable String parentSpanId,
                                                        @Nullable String sampled, @Nullable String flags, int port); static long getRandomLong(); static long hexUnsignedStringToLong(@Nonnull String hexValue);  }