@Test
public void testTracingSync() throws Exception {

  final RequestContext requestContext = mock(RequestContext.class);
  final Request request = Request.forUri("/bar", "GET");
  final MockSpan span = new MockSpan();
  when(requestContext.request()).thenReturn(request);
  when(tracer.spanBuilder("foo-service//bar")).thenReturn(spanBuilder);
  when(spanBuilder.startSpan()).thenReturn(span);
  awaitResponse(Middlewares.tracer(tracer, "foo-service")
      .apply(rc -> completedFuture(Response.ok()))
      .invoke(requestContext));
  verify(tracer).spanBuilder("foo-service//bar");
  verify(spanBuilder).startSpan();
  assertThat(span.attributes.get("method"), is(stringAttributeValue("GET")));
  assertThat(span.attributes.get("uri"), is(stringAttributeValue("/bar")));
  assertThat(span.ended, is(true));
  assertThat(span.status, is(nullValue()));
}