### Question:
ZipkinSocketRequestUuidResolver extends SocketRequestUuidResolver<Void> { @Override public void resolve(SocketContextResolutionParams params, Void ignore, DehydratedExecutionContextBuilder builder) { RequestUUID cougarUUID = super.resolve(params); String traceId = null; String spanId = null; String parentSpanId = null; String sampled = null; String flags = null; Map<String, String> additionalData = params.getAdditionalData(); if (additionalData != null) { traceId = additionalData.get(ZipkinKeys.TRACE_ID); spanId = additionalData.get(ZipkinKeys.SPAN_ID); parentSpanId = additionalData.get(ZipkinKeys.PARENT_SPAN_ID); sampled = additionalData.get(ZipkinKeys.SAMPLED); flags = additionalData.get(ZipkinKeys.FLAGS); } RequestUUID requestUUID = zipkinManager.createNewZipkinRequestUUID(cougarUUID, traceId, spanId, parentSpanId, sampled, flags, serverPort); builder.setRequestUUID(requestUUID); } ZipkinSocketRequestUuidResolver(ZipkinExecutionContextResolverFactory resolverFactory,
                                           ZipkinManager zipkinManager, int socketServerPort); @Override void resolve(SocketContextResolutionParams params, Void ignore, DehydratedExecutionContextBuilder builder);  }### Answer:
@Test public void resolve_WhenAdditionalDataIsNull_ShouldDeferHeaderInitialization() { when(params.getAdditionalData()).thenReturn(null); when(zipkinManager.createNewZipkinRequestUUID(any(RequestUUID.class), eq((String) null), eq((String) null), eq((String) null), eq((String) null), eq((String) null), eq(serverPort))) .thenReturn(requestUUID); victim.resolve(params, null, builder); verify(builder).setRequestUUID(requestUUID); }
@Test public void resolve_WhenAdditionalDataExists_ShouldPropagateHeaders() { String traceId = "123456789"; String spanId = "987654321"; String parentSpanId = "543216789"; String sampled = "1"; String flags = "327"; Map<String, String> additionalData = Maps.newHashMap(); additionalData.put(ZipkinKeys.TRACE_ID, traceId); additionalData.put(ZipkinKeys.SPAN_ID, spanId); additionalData.put(ZipkinKeys.PARENT_SPAN_ID, parentSpanId); additionalData.put(ZipkinKeys.SAMPLED, sampled); additionalData.put(ZipkinKeys.FLAGS, flags); when(params.getAdditionalData()).thenReturn(additionalData); when(zipkinManager.createNewZipkinRequestUUID(any(RequestUUID.class), eq(traceId), eq(spanId), eq(parentSpanId), eq(sampled), eq(flags), eq(serverPort))) .thenReturn(requestUUID); victim.resolve(params, null, builder); verify(builder).setRequestUUID(requestUUID); }