Skip to content

Commit 989e118

Browse files
committed
Review Feedback Vol. 1
1 parent 776f1f4 commit 989e118

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

spock-specs/src/test/groovy/org/spockframework/smoke/extension/RetryFeatureExtensionSpec.groovy

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ import static org.junit.platform.testkit.engine.EventConditions.finishedWithFail
2121
import static org.junit.platform.testkit.engine.EventConditions.test
2222
import static org.spockframework.runtime.model.parallel.ExecutionMode.SAME_THREAD
2323

24-
@Retention(RetentionPolicy.RUNTIME)
25-
@ExtensionAnnotation(RetryFeatureExtensionSpec.ChangeThreadExtension)
26-
@interface ChangeThread {
27-
}
28-
2924
@Execution(value = SAME_THREAD, reason = "tests use static field")
3025
class RetryFeatureExtensionSpec extends EmbeddedSpecification {
3126

@@ -693,17 +688,15 @@ def bar() {
693688
}
694689
695690
def "@Retry interceptor chains to enclosed interceptors each time"() {
696-
when:
697-
def result = runner.runWithImports("""
698-
import spock.lang.Retry
699-
import org.spockframework.smoke.extension.CountExecution
691+
given:
692+
runner.addClassImport(CountExecution)
700693
701-
class Foo extends Specification {
702-
@Retry
703-
@CountExecution
704-
def bar(baz) {
705-
expect: false
706-
}
694+
when:
695+
def result = runner.runSpecBody("""
696+
@Retry
697+
@CountExecution
698+
def bar(baz) {
699+
expect: false
707700
}
708701
""")
709702
@@ -747,14 +740,19 @@ class Foo extends Specification {
747740
@Override
748741
void visitFeatureAnnotation(CountExecution annotation, FeatureInfo feature) {
749742
feature.featureMethod.addInterceptor { invocation ->
750-
org.spockframework.smoke.extension.RetryFeatureExtensionSpec.extensionCounter.incrementAndGet()
743+
extensionCounter.incrementAndGet()
751744
invocation.resolveArgument(0, "BAZ")
752745
invocation.proceed()
753746
}
754747
}
755748
}
756749
}
757750
751+
@Retention(RetentionPolicy.RUNTIME)
752+
@ExtensionAnnotation(RetryFeatureExtensionSpec.ChangeThreadExtension)
753+
@interface ChangeThread {
754+
}
755+
758756
@Retention(RetentionPolicy.RUNTIME)
759757
@ExtensionAnnotation(RetryFeatureExtensionSpec.CountExecutionExtension)
760758
@interface CountExecution {

0 commit comments

Comments
 (0)