From efab7cd78e2a475c8181c9b2932112b0ff5b7379 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Fri, 25 May 2018 11:04:44 +0200 Subject: [PATCH] Please work --- .../servererrors/FeignClientServerErrorTests.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/servererrors/FeignClientServerErrorTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/servererrors/FeignClientServerErrorTests.java index ea1d260b5..d4f61bd68 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/servererrors/FeignClientServerErrorTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/servererrors/FeignClientServerErrorTests.java @@ -20,6 +20,7 @@ import java.util.Collections; import java.util.List; import java.util.Optional; +import brave.Tracer; import brave.Tracing; import brave.sampler.Sampler; import com.netflix.hystrix.exception.HystrixRuntimeException; @@ -86,6 +87,7 @@ public class FeignClientServerErrorTests { @Autowired TestFeignInterface feignInterface; @Autowired TestFeignWithCustomConfInterface customConfFeignInterface; @Autowired ArrayListSpanReporter reporter; + @Autowired Tracer tracer; @Before public void setup() { @@ -94,7 +96,7 @@ public class FeignClientServerErrorTests { @Test public void shouldCloseSpanOnInternalServerError(){ - try { + try(Tracer.SpanInScope ws = tracer.withSpanInScope(tracer.nextSpan().name("foo").start())) { log.info("sending a request"); this.feignInterface.internalError(); fail("Must throw an exception"); @@ -116,7 +118,7 @@ public class FeignClientServerErrorTests { @Test public void shouldCloseSpanOnNotFound() { - try { + try(Tracer.SpanInScope ws = tracer.withSpanInScope(tracer.nextSpan().name("foo").start())) { log.info("sending a request"); this.feignInterface.notFound(); fail("Must throw an exception"); @@ -137,7 +139,7 @@ public class FeignClientServerErrorTests { @Test public void shouldCloseSpanOnOk() { - try { + try(Tracer.SpanInScope ws = tracer.withSpanInScope(tracer.nextSpan().name("foo").start())) { log.info("sending a request"); this.feignInterface.ok(); } catch (HystrixRuntimeException e) { @@ -158,7 +160,7 @@ public class FeignClientServerErrorTests { @Test public void shouldCloseSpanOnOkWithCustomFeignConfiguration(){ - try { + try(Tracer.SpanInScope ws = tracer.withSpanInScope(tracer.nextSpan().name("foo").start())) { log.info("sending a request"); this.customConfFeignInterface.ok(); fail("Must throw an exception"); @@ -180,7 +182,7 @@ public class FeignClientServerErrorTests { @Test public void shouldCloseSpanOnNotFoundWithCustomFeignConfiguration(){ - try { + try(Tracer.SpanInScope ws = tracer.withSpanInScope(tracer.nextSpan().name("foo").start())) { log.info("sending a request"); this.customConfFeignInterface.notFound(); fail("Must throw an exception"); @@ -259,7 +261,6 @@ public class FeignClientServerErrorTests { ResponseEntity ok(); } - @Configuration public static class CustomFeignClientConfiguration { @Bean