class JsonSerializer extends BaseSerializer {

    @Override
    protected byte[] serialize(Object data) throws IOException {
        return gson.toJson(data).getBytes(Charsets.UTF_8);
    }

}

class JsonSerializerTest {

    @Test
    public void serializeOneAnnotated() throws Exception {

        Gson gson = new Gson();
        JsonSerializer serializer = new JsonSerializer(gson);

        Invokable<?, Object> method = Invokable.from(Methods.class.getMethod("oneAnnotated", Pojo.class));
        Parameter[] parameters = Iterables.toArray(method.getParameters(), Parameter.class);

        Pojo pojo = new Pojo("Hello world!", 42);
        byte[] bytes = serializer.serialize(parameters, new Object[] { pojo });

        String expected = gson.toJson(Collections.singletonMap("value", pojo));
        JSONAssert.assertEquals(expected, new String(bytes, Charsets.UTF_8), true);
    }

}