mirror of https://github.com/jwtk/jjwt.git
Fix for missing test.
This commit is contained in:
parent
73f7f9915b
commit
9cc7ecbeef
|
@ -6,6 +6,7 @@ import org.junit.Test
|
||||||
import static org.easymock.EasyMock.*
|
import static org.easymock.EasyMock.*
|
||||||
import static org.junit.Assert.*
|
import static org.junit.Assert.*
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
|
import io.jsonwebtoken.io.SerializationException
|
||||||
|
|
||||||
class GsonSerializerTest {
|
class GsonSerializerTest {
|
||||||
|
|
||||||
|
@ -69,31 +70,31 @@ class GsonSerializerTest {
|
||||||
assertTrue Arrays.equals(expected, result)
|
assertTrue Arrays.equals(expected, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
//THIS IS COMMENTED OUT BECAUSE GSN NEVER THROWS ANY SERIALIZATION EXCEPTION
|
|
||||||
// @Test
|
@Test
|
||||||
// void testSerializeFailsWithJsonProcessingException() {
|
void testSerializeFailsWithJsonProcessingException() {
|
||||||
//
|
|
||||||
// def ex = createMock(JsonProcessingException)
|
def ex = createMock(SerializationException)
|
||||||
//
|
|
||||||
// expect(ex.getMessage()).andReturn('foo')
|
expect(ex.getMessage()).andReturn('foo')
|
||||||
//
|
|
||||||
// def serializer = new GsonSerializer() {
|
def serializer = new GsonSerializer() {
|
||||||
// @Override
|
@Override
|
||||||
// protected byte[] writeValueAsBytes(Object o) throws JsonProcessingException {
|
protected byte[] writeValueAsBytes(Object o) throws SerializationException {
|
||||||
// throw ex
|
throw ex
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// replay ex
|
replay ex
|
||||||
//
|
|
||||||
// try {
|
try {
|
||||||
// serializer.serialize([hello: 'world'])
|
serializer.serialize([hello: 'world'])
|
||||||
// fail()
|
fail()
|
||||||
// } catch (SerializationException se) {
|
} catch (SerializationException se) {
|
||||||
// assertEquals 'Unable to serialize object: foo', se.getMessage()
|
assertEquals 'Unable to serialize object: foo', se.getMessage()
|
||||||
// assertSame ex, se.getCause()
|
assertSame ex, se.getCause()
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// verify ex
|
verify ex
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue