mirror of
https://github.com/jwtk/jjwt.git
synced 2025-02-10 18:24:42 +00:00
Merge pull request #62 from jwtk/coverage_report
Add Coveralls coverage report badge to README page
This commit is contained in:
commit
b63a67516e
@ -6,5 +6,9 @@ jdk:
|
||||
- oraclejdk7
|
||||
- oraclejdk8
|
||||
|
||||
before_install:
|
||||
- export BUILD_COVERAGE="$([ $TRAVIS_JDK_VERSION == 'openjdk7' ] && echo 'true')"
|
||||
install: echo "No need to run mvn install -DskipTests then mvn install. Running mvn install."
|
||||
script: mvn install
|
||||
after_success:
|
||||
- test -z "$BUILD_COVERAGE" || mvn clean cobertura:cobertura coveralls:report
|
||||
|
@ -1,4 +1,5 @@
|
||||
[![Build Status](https://travis-ci.org/jwtk/jjwt.svg?branch=master)](https://travis-ci.org/jwtk/jjwt)
|
||||
[![Coverage Status](https://coveralls.io/repos/jwtk/jjwt/badge.svg?branch=master)](https://coveralls.io/r/jwtk/jjwt?branch=master)
|
||||
|
||||
# Java JWT: JSON Web Token for Java and Android
|
||||
|
||||
|
8
pom.xml
8
pom.xml
@ -274,6 +274,8 @@
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
<configuration>
|
||||
<maxmem>256m</maxmem>
|
||||
<aggregate>true</aggregate>
|
||||
<instrumentation>
|
||||
<excludes>
|
||||
<exclude>io/jsonwebtoken/lang/*.class</exclude>
|
||||
@ -319,6 +321,7 @@
|
||||
</regexes>
|
||||
</check>
|
||||
<formats>
|
||||
<format>xml</format>
|
||||
<format>html</format>
|
||||
</formats>
|
||||
</configuration>
|
||||
@ -364,6 +367,11 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eluder.coveralls</groupId>
|
||||
<artifactId>coveralls-maven-plugin</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -19,6 +19,7 @@ import com.fasterxml.jackson.core.JsonProcessingException
|
||||
import com.fasterxml.jackson.databind.JsonMappingException
|
||||
import io.jsonwebtoken.Jwts
|
||||
import io.jsonwebtoken.SignatureAlgorithm
|
||||
import io.jsonwebtoken.impl.compression.CompressionCodecs
|
||||
import io.jsonwebtoken.impl.crypto.MacProvider
|
||||
import org.junit.Test
|
||||
|
||||
@ -187,6 +188,26 @@ class DefaultJwtBuilderTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCompactCompressionCodecJsonProcessingException() {
|
||||
def b = new DefaultJwtBuilder() {
|
||||
@Override
|
||||
protected byte[] toJson(Object o) throws JsonProcessingException {
|
||||
if (o instanceof DefaultJwsHeader) { return super.toJson(o) }
|
||||
throw new JsonProcessingException('simulate json processing exception on claims')
|
||||
}
|
||||
}
|
||||
|
||||
def c = Jwts.claims().setSubject("Joe");
|
||||
|
||||
try {
|
||||
b.setClaims(c).compressWith(CompressionCodecs.DEFLATE).compact()
|
||||
fail()
|
||||
} catch (IllegalArgumentException iae) {
|
||||
assertEquals iae.message, 'Unable to serialize claims object to json.'
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSignWithBytesWithoutHmac() {
|
||||
def bytes = new byte[16];
|
||||
|
Loading…
x
Reference in New Issue
Block a user