diff --git a/src/test/java/org/springframework/retry/annotation/RetryableXmlConfigTests.java b/src/test/java/org/springframework/retry/annotation/RetryableXmlConfigTests.java new file mode 100644 index 00000000..556591df --- /dev/null +++ b/src/test/java/org/springframework/retry/annotation/RetryableXmlConfigTests.java @@ -0,0 +1,59 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.retry.annotation; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Artem Bilan + * @since 2.0.9 + */ +@SpringJUnitConfig +public class RetryableXmlConfigTests { + + @Autowired + Service service; + + @Test + void serviceCallIsRetied() { + this.service.service(); + assertThat(service.getCount()).isEqualTo(3); + } + + public static class Service { + + private int count = 0; + + @Retryable + public void service() { + if (this.count++ < 2) { + throw new RuntimeException("Planned"); + } + } + + public int getCount() { + return this.count; + } + + } + +} diff --git a/src/test/resources/org/springframework/retry/annotation/RetryableXmlConfigTests-context.xml b/src/test/resources/org/springframework/retry/annotation/RetryableXmlConfigTests-context.xml new file mode 100644 index 00000000..1333863d --- /dev/null +++ b/src/test/resources/org/springframework/retry/annotation/RetryableXmlConfigTests-context.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file