Skip to content

Commit

Permalink
Testing Java LTS versions (#536)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
poovamraj authored Mar 7, 2022
1 parent 5c94325 commit ed91dc6
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ dependencies {
testImplementation 'org.mockito:mockito-core:2.18.3'
}

jacoco {
toolVersion = "0.8.7"
}

jacocoTestReport {
reports {
xml.enabled = true
Expand Down Expand Up @@ -87,6 +91,48 @@ task compileModuleInfoJava(type: JavaCompile) {
}
}

compileTestJava {
options.compilerArgs = ['--release', "8"]
}

def testJava8 = tasks.register('testJava8', Test) {
description = 'Runs unit tests on Java 8.'
group = 'verification'

javaLauncher.set(javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
})
shouldRunAfter(tasks.named('test'))
}

def testJava17 = tasks.register('testJava17', Test) {
description = 'Runs unit tests on Java 17.'
group = 'verification'

javaLauncher.set(javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
})
shouldRunAfter(tasks.named('test'))

//Following Tests are excluded in Java 17 since secp256k1 curve is disabled Java 15+
filter {
excludeTestsMatching "*.jwt.ConcurrentVerifyTest.shouldPassECDSA256KVerificationWithJOSESignature"
excludeTestsMatching "*.jwt.JWTCreatorTest.shouldAddKeyIdIfAvailableFromECDSAKAlgorithms"
excludeTestsMatching "*.jwt.JWTCreatorTest.shouldNotOverwriteKeyIdIfAddedFromECDSAKAlgorithms"
excludeTestsMatching "*.jwt.JWTTest.shouldCreateAnEmptyECDSA256KSignedToken"
excludeTestsMatching "*.jwt.algorithms.ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithJOSESignature"
excludeTestsMatching "*.jwt.algorithms.ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithJOSESignatureWithBothKeys"
excludeTestsMatching "*.jwt.algorithms.ECDSAAlgorithmTest.shouldPassECDSA256KVerificationWithProvidedPublicKey"
excludeTestsMatching "*.jwt.ECDSABouncyCastleProviderTests.shouldPassECDSA256KVerificationWithJOSESignatureWithBothKeys"
excludeTestsMatching "*.jwt.ECDSABouncyCastleProviderTests.shouldPassECDSA256KVerificationWithProvidedPublicKey"
}
}

tasks.named('check') {
dependsOn(testJava8)
dependsOn(testJava17)
}

jar {
manifest.attributes('Multi-Release': 'true')
}
Expand Down

0 comments on commit ed91dc6

Please sign in to comment.