@@ -6,18 +6,16 @@ import org.junit.jupiter.api.extension.InvocationInterceptor
66import org.junit.jupiter.api.extension.InvocationInterceptor.Invocation
77import org.junit.jupiter.api.extension.ReflectiveInvocationContext
88import org.opentest4j.TestAbortedException
9- import java.lang.annotation.Inherited
109import java.lang.reflect.AnnotatedElement
1110import java.lang.reflect.Method
1211import java.util.*
1312
14- @Target(AnnotationTarget .CLASS , AnnotationTarget . FUNCTION )
13+ @Target(AnnotationTarget .CLASS )
1514@Retention(AnnotationRetention .RUNTIME )
16- @Inherited
1715@ExtendWith(RetryExtension ::class )
1816annotation class Retry (
1917 val times : Int = 3 ,
20- val delayMs : Long = 0 ,
18+ val delayMs : Long = 1000 ,
2119)
2220
2321class RetryExtension : InvocationInterceptor {
@@ -30,8 +28,6 @@ class RetryExtension : InvocationInterceptor {
3028 }
3129
3230 private fun resolveRetryAnnotation (extensionContext : ExtensionContext ): Retry ? {
33- val methodAnn = extensionContext.testMethod.flatMap { findRetry(it) }
34- if (methodAnn.isPresent) return methodAnn.get()
3531 val classAnn = extensionContext.testClass.flatMap { findRetry(it) }
3632 return classAnn.orElse(null )
3733 }
@@ -90,4 +86,4 @@ class RetryExtension : InvocationInterceptor {
9086 val className = ctx.testClass.map { it.name }.orElse(" <unknown>" )
9187 return " $className #$methodName "
9288 }
93- }
89+ }
0 commit comments