Base16BigIntegerSerializer extends JsonSerializer<BigInteger> { @Override public void serialize(final BigInteger value, final JsonGenerator gen, final SerializerProvider serializers) throws IOException, JsonProcessingException { gen.writeString(IdUtil.toString(value)); }  @Override void serialize(final BigInteger value,
                          final JsonGenerator gen,
                          final SerializerProvider serializers);  }
@Test public void testGenericConstructor() throws Exception { BigInteger id = IdUtil.next(); String idString = IdUtil.toString(id); JsonSerializer serializer = new Base16BigIntegerSerializer(); JsonGenerator generator = mock(JsonGenerator.class); serializer.serialize(id, generator, null); verify(generator).writeString(idString); }
@Test public void deserialize() throws Exception { BigInteger id = IdUtil.next(); String idString = IdUtil.toString(id); Base16BigIntegerSerializer serializer = new Base16BigIntegerSerializer(); JsonGenerator generator = mock(JsonGenerator.class); serializer.serialize(id, generator, null); verify(generator).writeString(idString); }