From f60ae3be29004f9e844ca2e88ed876e2eb01ab63 Mon Sep 17 00:00:00 2001 From: pivovarit Date: Fri, 13 Jan 2017 07:56:41 +0100 Subject: [PATCH] Refactor SpringRetryTest --- .../org/baeldung/springretry/SpringRetryTest.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/spring-all/src/test/java/org/baeldung/springretry/SpringRetryTest.java b/spring-all/src/test/java/org/baeldung/springretry/SpringRetryTest.java index 52f59dc49a..2f3411957e 100644 --- a/spring-all/src/test/java/org/baeldung/springretry/SpringRetryTest.java +++ b/spring-all/src/test/java/org/baeldung/springretry/SpringRetryTest.java @@ -1,17 +1,15 @@ package org.baeldung.springretry; -import java.sql.SQLException; - import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.retry.RetryCallback; -import org.springframework.retry.RetryContext; import org.springframework.retry.support.RetryTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; +import java.sql.SQLException; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = AppConfig.class, loader = AnnotationConfigContextLoader.class) public class SpringRetryTest { @@ -34,12 +32,9 @@ public class SpringRetryTest { @Test(expected = RuntimeException.class) public void givenTemplateRetryService_whenCallWithException_thenRetry() { - retryTemplate.execute(new RetryCallback() { - @Override - public Void doWithRetry(RetryContext arg0) { - myService.templateRetryService(); - return null; - } + retryTemplate.execute(arg0 -> { + myService.templateRetryService(); + return null; }); } }