@@ -39,6 +39,29 @@ def bar() {
3939 }
4040 }
4141
42+ def " @PendingFeature marks failing feature as skipped even if applied twice" () {
43+ when :
44+ def result = runner. runSpecBody """
45+ @PendingFeature
46+ @PendingFeature
47+ def bar() {
48+ expect: false
49+ }
50+ """
51+
52+ then :
53+ verifyAll(result) {
54+ testsStartedCount == 1
55+ testsSucceededCount == 0
56+ testsFailedCount == 0
57+ testsSkippedCount == 0
58+ testsAbortedCount == 1
59+ testEvents(). aborted(). assertEventsMatchExactly(
60+ abortedWithReason(message(' Feature not yet implemented correctly.' ))
61+ )
62+ }
63+ }
64+
4265 def " @PendingFeature includes reason in exception message" () {
4366 when :
4467 def result = runner. runSpecBody """
@@ -61,6 +84,52 @@ def bar() {
6184 }
6285 }
6386
87+ def " @PendingFeature includes last reason in exception message if applied twice" () {
88+ when :
89+ def result = runner. runSpecBody """
90+ @PendingFeature(reason='42')
91+ @PendingFeature(reason='4711')
92+ def bar() {
93+ expect: false
94+ }
95+ """
96+
97+ then :
98+ verifyAll(result) {
99+ testsStartedCount == 1
100+ testsSucceededCount == 0
101+ testsFailedCount == 0
102+ testsSkippedCount == 0
103+ testsAbortedCount == 1
104+ testEvents(). aborted(). assertEventsMatchExactly(
105+ abortedWithReason(message(' Feature not yet implemented correctly. Reason: 4711' ))
106+ )
107+ }
108+ }
109+
110+ def " @PendingFeature includes reason of matching annotation in exception message if applied twice" () {
111+ when :
112+ def result = runner. runSpecBody """
113+ @PendingFeature(exceptions=IllegalArgumentException, reason='42')
114+ @PendingFeature(exceptions=IllegalAccessException, reason='4711')
115+ def bar() {
116+ expect: throw new IllegalArgumentException()
117+ }
118+ """
119+
120+ then :
121+ verifyAll(result) {
122+ testsStartedCount == 1
123+ testsSucceededCount == 0
124+ testsFailedCount == 0
125+ testsSkippedCount == 0
126+ testsAbortedCount == 1
127+ testEvents(). aborted(). assertEventsMatchExactly(
128+ abortedWithReason(message(' Feature not yet implemented correctly. Reason: 42' ))
129+ )
130+ }
131+ }
132+
64133 def " @PendingFeature marks feature that fails with exception as skipped" () {
65134 when :
66135 def result = runner. runSpecBody """
@@ -107,6 +176,30 @@ def bar() {
107176 }
108177 }
109178
179+ def " @PendingFeature rethrows non handled exceptions even if applied twice" () {
180+ when :
181+ def result = runner. runSpecBody """
182+ @PendingFeature(exceptions=IndexOutOfBoundsException)
183+ @PendingFeature(exceptions=IllegalAccessException)
184+ def bar() {
185+ expect:
186+ throw new IllegalArgumentException()
187+ }
188+ """
189+
190+ then :
191+ verifyAll(result) {
192+ testsStartedCount == 1
193+ testsSucceededCount == 0
194+ testsFailedCount == 1
195+ testsSkippedCount == 0
196+ testsAbortedCount == 0
197+ testEvents(). failed(). assertEventsMatchExactly(
198+ finishedWithFailure(instanceOf(IllegalArgumentException ))
199+ )
200+ }
201+ }
202+
110203 def " @PendingFeature marks passing feature as failed" () {
111204 when :
112205 def result = runner. runSpecBody """
@@ -129,6 +222,29 @@ def bar() {
129222 }
130223 }
131224
225+ def " @PendingFeature marks passing feature as failed even if applied twice" () {
226+ when :
227+ def result = runner. runSpecBody """
228+ @PendingFeature
229+ @PendingFeature
230+ def bar() {
231+ expect: true
232+ }
233+ """
234+
235+ then :
236+ verifyAll(result) {
237+ testsStartedCount == 1
238+ testsSucceededCount == 0
239+ testsFailedCount == 1
240+ testsSkippedCount == 0
241+ testsAbortedCount == 0
242+ testEvents(). failed(). assertEventsMatchExactly(
243+ finishedWithFailure(message(' Feature is marked with @PendingFeature but passes unexpectedly' ))
244+ )
245+ }
246+ }
247+
132248 def " @PendingFeature ignores aborted feature" () {
133249 when :
134250 def result = runner. runSpecBody """
0 commit comments