Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing Java LTS versions #536

Merged
merged 5 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 1 addition & 4 deletions lib/src/test/java/com/auth0/jwt/ConcurrentVerifyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import net.jodah.concurrentunit.Waiter;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.*;
import org.junit.rules.ExpectedException;

import java.security.interfaces.ECKey;
Expand Down
1 change: 1 addition & 0 deletions lib/src/test/java/com/auth0/jwt/JWTCreatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.auth0.jwt.interfaces.RSAKeyProvider;
import com.fasterxml.jackson.databind.ObjectMapper;

import org.junit.Ignore;
poovamraj marked this conversation as resolved.
Show resolved Hide resolved
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand Down
1 change: 1 addition & 0 deletions lib/src/test/java/com/auth0/jwt/JWTTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.auth0.jwt.interfaces.DecodedJWT;
import org.hamcrest.collection.IsCollectionWithSize;
import org.hamcrest.core.IsCollectionContaining;
import org.junit.Ignore;
poovamraj marked this conversation as resolved.
Show resolved Hide resolved
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.auth0.jwt.interfaces.ECDSAKeyProvider;
import org.hamcrest.Matchers;
import org.hamcrest.collection.IsIn;
import org.junit.Ignore;
poovamraj marked this conversation as resolved.
Show resolved Hide resolved
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import com.auth0.jwt.exceptions.SignatureVerificationException;
import com.auth0.jwt.interfaces.ECDSAKeyProvider;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.*;
import org.junit.rules.ExpectedException;

import java.nio.charset.StandardCharsets;
Expand Down