diff --git a/config-retry/src/test/java/demo/StandaloneClientApplicationTests.java b/config-retry/src/test/java/demo/StandaloneClientApplicationTests.java index 2b61b4e..4070c80 100644 --- a/config-retry/src/test/java/demo/StandaloneClientApplicationTests.java +++ b/config-retry/src/test/java/demo/StandaloneClientApplicationTests.java @@ -2,6 +2,7 @@ package demo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.lang.reflect.Method; import java.util.Map; @@ -71,10 +72,23 @@ public class StandaloneClientApplicationTests { @SuppressWarnings("unchecked") Map delegates = (Map) ReflectionTestUtils .getField(advice, "delegates"); - RetryOperationsInterceptor interceptor = (RetryOperationsInterceptor) delegates + Object obj = delegates .values().iterator().next(); - RetryTemplate retryTemplate = (RetryTemplate) ReflectionTestUtils.getField( - interceptor, "retryOperations"); + RetryTemplate retryTemplate = null; + if(RetryOperationsInterceptor.class.isInstance(obj)) { + //Prior to Boot 1.5.10 + RetryOperationsInterceptor interceptor = (RetryOperationsInterceptor)obj; + retryTemplate = (RetryTemplate) ReflectionTestUtils.getField( + interceptor, "retryOperations"); + } else if(Map.class.isInstance(obj)) { + //Boot 1.5.10 and later + Object[] methodInterceptors = ((Map)obj).values().toArray(); + RetryOperationsInterceptor interceptor = (RetryOperationsInterceptor)methodInterceptors[0]; + retryTemplate = (RetryTemplate)ReflectionTestUtils.getField( + interceptor, "retryOperations");; + } else { + fail("Could not find RetryTemplate"); + } ExponentialBackOffPolicy backoff = (ExponentialBackOffPolicy) ReflectionTestUtils .getField(retryTemplate, "backOffPolicy"); assertEquals(3000, backoff.getInitialInterval());