Skip to content

Commit efcaae3

Browse files
committed
Revert "Convert to JUnit5"
This reverts commit 8acb53b.
1 parent e4123d9 commit efcaae3

File tree

1,223 files changed

+3613
-11001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,223 files changed

+3613
-11001
lines changed

src/spec/test/BaseScriptSpecTest.groovy

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
19+
import groovy.test.GroovyTestCase
2020
import groovy.transform.CompileStatic
2121

22-
import static groovy.test.GroovyAssert.assertScript
23-
2422
@CompileStatic
25-
class BaseScriptSpecTest {
23+
class BaseScriptSpecTest extends GroovyTestCase {
2624
void testSimpleScript() {
2725
def script = '''
2826
// tag::simple_script[]

src/spec/test/ClassDesignASTTransformsTest.groovy

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19+
import groovy.test.GroovyTestCase
1920

21+
class ClassDesignASTTransformsTest extends GroovyTestCase {
2022

21-
import org.junit.jupiter.api.Test
22-
23-
import static groovy.test.GroovyAssert.assertScript
24-
25-
class ClassDesignASTTransformsTest {
26-
27-
@Test
2823
void testDelegateTransformation() {
2924
assertScript '''
3025
// tag::delegating_class[]
@@ -274,7 +269,6 @@ d.task$() //passes
274269
'''
275270
}
276271

277-
@Test
278272
void testImmutable() {
279273
assertScript '''
280274
// tag::immutable_simple[]
@@ -375,7 +369,6 @@ try {
375369
'''
376370
}
377371

378-
@Test
379372
void testMemoized() {
380373
assertScript '''
381374
import groovy.transform.Memoized
@@ -414,7 +407,6 @@ assert x!=z
414407
'''
415408
}
416409

417-
@Test
418410
void testSingleton() {
419411
assertScript '''
420412
// tag::singleton_simple[]
@@ -459,7 +451,6 @@ assert GreetingService.instance.greeting('Bob') == 'Hello, Bob!'
459451
'''
460452
}
461453

462-
@Test
463454
void testTailRecursive() {
464455
assertScript '''
465456
// tag::tailrecursive[]

src/spec/test/ClassTest.groovy

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
* under the License.
1818
*/
1919

20+
import groovy.test.GroovyTestCase
2021

21-
final class ClassTest {
22+
final class ClassTest extends GroovyTestCase {
2223

2324
void testClassDefinition() {
2425
assertScript '''
@@ -229,7 +230,7 @@ final class ClassTest {
229230
}
230231
// end::protected_forbidden[]
231232
'''
232-
assert err.message.contains("The method 'greet' must be public as it is declared abstract in interface 'Greeter'")
233+
assert err.contains("The method 'greet' must be public as it is declared abstract in interface 'Greeter'")
233234
}
234235

235236
void testFields() {
@@ -729,7 +730,7 @@ import java.lang.annotation.Retention
729730
class Evil {}
730731
Evil
731732
'''
732-
assert err.message =~ /Attribute 'value' should have type 'java.lang.String'; but found type 'int' in @Foo/
733+
assert err =~ /Attribute 'value' should have type 'java.lang.String'; but found type 'int' in @Foo/
733734
}
734735

735736
void testCustomProcessor() {
@@ -759,9 +760,6 @@ import java.lang.annotation.Retention
759760
import org.codehaus.groovy.ast.expr.PropertyExpression
760761
import org.codehaus.groovy.control.SourceUnit
761762
import org.codehaus.groovy.transform.AnnotationCollectorTransform
762-
import org.junit.jupiter.api.Test
763-
import org.junit.jupiter.api.Timeout
764-
import static groovy.test.GroovyAssert.*
765763
766764
// tag::compiledynamic_def_fixed[]
767765
@AnnotationCollector(processor = "org.codehaus.groovy.transform.CompileDynamicProcessor")

src/spec/test/CloningASTTransformsTest.groovy

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import groovy.test.GroovyTestCase
12

23
/*
34
* Licensed to the Apache Software Foundation (ASF) under one
@@ -17,13 +18,7 @@
1718
* specific language governing permissions and limitations
1819
* under the License.
1920
*/
20-
21-
import org.junit.jupiter.api.Test
22-
23-
import static groovy.test.GroovyAssert.assertScript
24-
25-
class CloningASTTransformsTest {
26-
@Test
21+
class CloningASTTransformsTest extends GroovyTestCase {
2722
void testAutoCloneAnnotation() {
2823
assertScript '''
2924
// tag::example_autoclone[]
@@ -64,7 +59,6 @@ assert !(book.authors.is(clone.authors))
6459
'''
6560
}
6661

67-
@Test
6862
void testAutoCloneAnnotationWithExclude() {
6963
assertScript '''
7064
// tag::example_autoclone_excludes[]
@@ -88,7 +82,6 @@ assert clone.publicationDate==book.publicationDate
8882
'''
8983
}
9084

91-
@Test
9285
void testAutoCloneAnnotationWithIncludeFields() {
9386
assertScript '''
9487
// tag::example_autoclone_includeFields[]
@@ -112,7 +105,6 @@ assert clone.publicationDate==book.publicationDate
112105
'''
113106
}
114107

115-
@Test
116108
void testAutoExternalize() {
117109
assertScript '''
118110
// tag::example_autoext[]
@@ -176,7 +168,6 @@ assert book.price == 1.5
176168
'''
177169
}
178170

179-
@Test
180171
void testAutoExternalizeWithExcludes() {
181172
assertScript '''
182173
// tag::example_autoext_excludes[]
@@ -218,7 +209,6 @@ assert book.title == 'Auto externalization for dummies'
218209
assert book.price == 0 // because price is excluded
219210
'''
220211
}
221-
@Test
222212
void testAutoExternalizeWithIncludeFields() {
223213
assertScript '''
224214
// tag::example_autoext_includeFields[]

src/spec/test/ClosuresSpecTest.groovy

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import org.junit.jupiter.api.Test
2-
3-
import static groovy.test.GroovyAssert.assertScript
1+
import groovy.test.GroovyTestCase
42

53
/*
64
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,10 +18,9 @@ import static groovy.test.GroovyAssert.assertScript
2018
* specific language governing permissions and limitations
2119
* under the License.
2220
*/
23-
class ClosuresSpecTest {
21+
class ClosuresSpecTest extends GroovyTestCase {
2422
static void sink(Closure cl) {}
2523

26-
@Test
2724
void testClosureSyntax() {
2825
sink
2926
// tag::closure_syntax_1[]
@@ -64,7 +61,6 @@ class ClosuresSpecTest {
6461
// end::closure_syntax_6[]
6562
}
6663

67-
@Test
6864
void testAssignClosureToAVariable() {
6965
// tag::closure_is_an_instance_of_Closure[]
7066
def listener = { e -> println "Clicked on $e.source" } // <1>
@@ -76,7 +72,6 @@ class ClosuresSpecTest {
7672
// end::closure_is_an_instance_of_Closure[]
7773
}
7874

79-
@Test
8075
void testCallClosure() {
8176
// tag::closure_call_1[]
8277
def code = { 123 }
@@ -99,7 +94,6 @@ class ClosuresSpecTest {
9994
// end::closure_call_2[]
10095
}
10196

102-
@Test
10397
void testClosureParameters() {
10498
// tag::closure_param_declaration[]
10599
def closureWithOneArg = { str -> str.toUpperCase() }
@@ -122,7 +116,6 @@ class ClosuresSpecTest {
122116
// end::closure_param_declaration[]
123117
}
124118

125-
@Test
126119
void testImplicitIt() {
127120
assertScript '''
128121
// tag::implicit_it[]
@@ -153,7 +146,6 @@ class ClosuresSpecTest {
153146
'''
154147
}
155148

156-
@Test
157149
void testClosureVargs() {
158150
// tag::closure_vargs[]
159151
def concat1 = { String... args -> args.join('') } // <1>
@@ -169,7 +161,6 @@ class ClosuresSpecTest {
169161

170162
}
171163

172-
@Test
173164
void testThisObject() {
174165
assertScript '''
175166
// tag::closure_this[]
@@ -226,7 +217,6 @@ class ClosuresSpecTest {
226217
'''
227218
}
228219

229-
@Test
230220
void testOwner() {
231221
assertScript '''
232222
// tag::closure_owner[]
@@ -263,7 +253,6 @@ class ClosuresSpecTest {
263253
'''
264254
}
265255

266-
@Test
267256
void testClosureDelegate() {
268257
assertScript '''
269258
// tag::delegate_is_owner[]
@@ -317,7 +306,6 @@ class ClosuresSpecTest {
317306
'''
318307
}
319308

320-
@Test
321309
void testDelegationStrategy() {
322310
assertScript '''
323311
// tag::delegation_strategy_intro[]
@@ -332,7 +320,6 @@ class ClosuresSpecTest {
332320
'''
333321
}
334322

335-
@Test
336323
void testOwnerFirst() {
337324
assertScript '''
338325
// tag::closure_owner_first[]
@@ -362,7 +349,6 @@ class ClosuresSpecTest {
362349
'''
363350
}
364351

365-
@Test
366352
void testDelegateOnly() {
367353
assertScript '''
368354
// tag::delegate_only[]
@@ -397,7 +383,6 @@ class ClosuresSpecTest {
397383
'''
398384
}
399385

400-
@Test
401386
void testDelegateOnlyPropertyMissing() {
402387
assertScript '''
403388
// tag::delegate_only_prop_missing[]
@@ -423,7 +408,6 @@ class ClosuresSpecTest {
423408
'''
424409
}
425410

426-
@Test
427411
void testGStringEager() {
428412
// tag::gstring_eager_intro[]
429413
def x = 1
@@ -440,7 +424,6 @@ class ClosuresSpecTest {
440424
assert gs == 'x = 1'
441425
}
442426

443-
@Test
444427
void testGStringLazy() {
445428
// tag::gstring_lazy[]
446429
def x = 1
@@ -452,7 +435,6 @@ class ClosuresSpecTest {
452435
// end::gstring_lazy[]
453436
}
454437

455-
@Test
456438
void testGStringWithMutation() {
457439
assertScript '''
458440
// tag::gstring_mutation[]
@@ -473,7 +455,6 @@ class ClosuresSpecTest {
473455
'''
474456
}
475457

476-
@Test
477458
void testGStringWithoutMutation() {
478459
assertScript '''
479460
// tag::gstring_no_mutation[]
@@ -493,7 +474,6 @@ class ClosuresSpecTest {
493474
'''
494475
}
495476

496-
@Test
497477
void testLeftCurry() {
498478
// tag::left_curry[]
499479
def nCopies = { int n, String str -> str*n } // <1>
@@ -503,7 +483,6 @@ class ClosuresSpecTest {
503483
// end::left_curry[]
504484
}
505485

506-
@Test
507486
void testRightCurry() {
508487
// tag::right_curry[]
509488
def nCopies = { int n, String str -> str*n } // <1>
@@ -513,7 +492,6 @@ class ClosuresSpecTest {
513492
// end::right_curry[]
514493
}
515494

516-
@Test
517495
void testNCurry() {
518496
// tag::ncurry[]
519497
def volume = { double l, double w, double h -> l*w*h } // <1>
@@ -524,7 +502,6 @@ class ClosuresSpecTest {
524502
// end::ncurry[]
525503
}
526504

527-
@Test
528505
void testMemoize() {
529506
// tag::naive_fib[]
530507
def fib
@@ -537,7 +514,6 @@ class ClosuresSpecTest {
537514
// end::memoized_fib[]
538515
}
539516

540-
@Test
541517
void testComposition() {
542518
// tag::closure_composition[]
543519
def plus2 = { it + 2 }
@@ -557,7 +533,6 @@ class ClosuresSpecTest {
557533

558534
}
559535

560-
@Test
561536
void testTrampoline() {
562537
// tag::trampoline[]
563538
def factorial

0 commit comments

Comments
 (0)