### Question:
ZipkinRequestUUIDImpl implements ZipkinRequestUUID { @Override public ZipkinData buildZipkinData(@Nonnull String spanName) { Objects.requireNonNull(spanName); if (zipkinData == null) { zipkinData = zipkinDataBuilder.spanName(spanName).build(); return zipkinData; } else { throw new IllegalStateException("Span name was already set for this request."); } } ZipkinRequestUUIDImpl(@Nonnull RequestUUID cougarUuid);  ZipkinRequestUUIDImpl(@Nonnull RequestUUID cougarUuid, @Nullable ZipkinDataBuilder zipkinDataBuilder); @Override String getRootUUIDComponent(); @Override String getParentUUIDComponent(); @Override String getLocalUUIDComponent(); @Override @Nonnull RequestUUID getNewSubUUID(); @Override @Nonnull ZipkinData getZipkinData(); @Override boolean isZipkinTracingEnabled(); @Override boolean isZipkinTracingReady(); @Override ZipkinData buildZipkinData(@Nonnull String spanName); @Override String getUUID(); @Override String toCougarLogString(); @Override String toString();  }### Answer:
@Test(expected = NullPointerException.class) public void buildZipkinData_WhenSpanNameIsNull_ShouldThrowNPE() { victim = new ZipkinRequestUUIDImpl(cougarUuid, null); victim.buildZipkinData(null); }
@Test public void buildZipkinData_WhenCalledForTheFirstTime_ShouldPopulateAndReturnZipkinData() { String spanName = "Span Name"; when(zipkinDataBuilder.spanName(spanName)).thenReturn(zipkinDataBuilder); when(zipkinDataBuilder.build()).thenReturn(zipkinData); victim = new ZipkinRequestUUIDImpl(cougarUuid, zipkinDataBuilder); ZipkinData result = victim.buildZipkinData(spanName); assertEquals(zipkinData, result); }
@Test(expected = IllegalStateException.class) public void buildZipkinData_WhenZipkinDataAlreadyExists_ShouldThrowISE() { String spanName = "Span Name"; when(zipkinDataBuilder.spanName(spanName)).thenReturn(zipkinDataBuilder); when(zipkinDataBuilder.build()).thenReturn(zipkinData); victim = new ZipkinRequestUUIDImpl(cougarUuid, zipkinDataBuilder); victim.buildZipkinData(spanName); victim.buildZipkinData(spanName); }