From 3336018c7face3f0addaf8f4d6fe64d87bc28796 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Thu, 16 Apr 2020 10:29:12 -0400 Subject: [PATCH] Move to try/catch for test --- .../config/ConsulPropertySourceLocatorRetryTests.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorRetryTests.java b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorRetryTests.java index 232c6931..b4330dd9 100644 --- a/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorRetryTests.java +++ b/spring-cloud-consul-config/src/test/java/org/springframework/cloud/consul/config/ConsulPropertySourceLocatorRetryTests.java @@ -48,7 +48,8 @@ public class ConsulPropertySourceLocatorRetryTests { @Test public void testRetry() { - Assert.assertThrows(TransportException.class, () -> { + //Assert.assertThrows(TransportException.class, () -> { + try { new SpringApplicationBuilder(Config.class).properties( "spring.application.name=testConsulPropertySourceLocatorRetry", "spring.cloud.consul.host=53210a7c-4809-42cb-8b30-057d2db85fcc", @@ -56,7 +57,12 @@ public class ConsulPropertySourceLocatorRetryTests { "spring.cloud.consul.port=65530", "spring.cloud.consul.retry.maxAttempts=1", "spring.cloud.consul.config.failFast=true").run(); - }); + Assert.fail("Did not throw TransportException"); + } + catch (TransportException e) { + // success + } + //}); assertThat(output).contains("RetryContext retrieved"); }