Skip to content

Commit ed91dc6

Browse files
authored
Testing Java LTS versions (#536)
* Added Gradle Tasks to run tests on Java LTS versions * Ignore secp256k1 curve tests * Removing ignore for tests and checking the CI failure * Exclude secp256k1 Tests for Java 17 * Remove unwanted "ignore" imports
1 parent 5c94325 commit ed91dc6

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

lib/build.gradle

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ dependencies {
5555
testImplementation 'org.mockito:mockito-core:2.18.3'
5656
}
5757

58+
jacoco {
59+
toolVersion = "0.8.7"
60+
}
61+
5862
jacocoTestReport {
5963
reports {
6064
xml.enabled = true
@@ -87,6 +91,48 @@ task compileModuleInfoJava(type: JavaCompile) {
8791
}
8892
}
8993

94+
compileTestJava {
95+
options.compilerArgs = ['--release', "8"]
96+
}
97+
98+
def testJava8 = tasks.register('testJava8', Test) {
99+
description = 'Runs unit tests on Java 8.'
100+
group = 'verification'
101+
102+
javaLauncher.set(javaToolchains.launcherFor {
103+
languageVersion = JavaLanguageVersion.of(8)
104+
})
105+
shouldRunAfter(tasks.named('test'))
106+
}
107+
108+
def testJava17 = tasks.register('testJava17', Test) {
109+
description = 'Runs unit tests on Java 17.'
110+
group = 'verification'
111+
112+
javaLauncher.set(javaToolchains.launcherFor {
113+
languageVersion = JavaLanguageVersion.of(17)
114+
})
115+
shouldRunAfter(tasks.named('test'))
116+
117+
//Following Tests are excluded in Java 17 since secp256k1 curve is disabled Java 15+
118+
filter {
119+
excludeTestsMatching "*.jwt.ConcurrentVerifyTest.shouldPassECDSA256KVerificationWithJOSESignature"
120+
excludeTestsMatching "*.jwt.JWTCreatorTest.shouldAddKeyIdIfAvailableFromECDSAKAlgorithms"
121+
excludeTestsMatching "*.jwt.JWTCreatorTest.shouldNotOverwriteKeyIdIfAddedFromECDSAKAlgorithms"
122+
excludeTestsMatching "*.jwt.JWTTest.shouldCreateAnEmptyECDSA256KSignedToken"
123+
excludeTestsMatching "*.jwt.algorithms.ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithJOSESignature"
124+
excludeTestsMatching "*.jwt.algorithms.ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithJOSESignatureWithBothKeys"
125+
excludeTestsMatching "*.jwt.algorithms.ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithProvidedPublicKey"
126+
excludeTestsMatching "*.jwt.ECDSABouncyCastleProviderTests.shouldPassECDSA256KVerificationWithJOSESignatureWithBothKeys"
127+
excludeTestsMatching "*.jwt.ECDSABouncyCastleProviderTests.shouldPassECDSA256KVerificationWithProvidedPublicKey"
128+
}
129+
}
130+
131+
tasks.named('check') {
132+
dependsOn(testJava8)
133+
dependsOn(testJava17)
134+
}
135+
90136
jar {
91137
manifest.attributes('Multi-Release': 'true')
92138
}

0 commit comments

Comments
 (0)