Skip to content

Commit 4b4a464

Browse files
committed
make non-indy test more lenient
1 parent 61279a2 commit 4b4a464

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/org/codehaus/groovy/transform/ImmutableTransformTest.groovy

+7-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import org.codehaus.groovy.control.MultipleCompilationErrorsException
2222
import org.junit.Test
2323

2424
import static groovy.test.GroovyAssert.assertScript
25+
import static groovy.test.GroovyAssert.isAtLeastJdk
2526
import static groovy.test.GroovyAssert.shouldFail
2627

2728
/**
@@ -108,7 +109,10 @@ final class ImmutableTransformTest {
108109

109110
@Test
110111
void testCloneableFieldNotCloneableObject() {
111-
shouldFail CloneNotSupportedException, '''import groovy.transform.*
112+
// attempting to access the protected clone() method is illegal from JDK16
113+
def expectedException = isAtLeastJdk('16.0') ? IllegalAccessException : CloneNotSupportedException
114+
shouldFail expectedException, '''
115+
import groovy.transform.*
112116
class Dolly {
113117
String name
114118
}
@@ -125,7 +129,8 @@ final class ImmutableTransformTest {
125129

126130
@Test
127131
void testImmutableListProp() {
128-
def objects = new GroovyShell().evaluate '''import groovy.transform.*
132+
def objects = new GroovyShell().evaluate '''
133+
import groovy.transform.*
129134
@Immutable class HasList {
130135
char[] letters
131136
List numbers

0 commit comments

Comments
 (0)