From e652ec0dd9b37a9c68173b650bad3ccd62619326 Mon Sep 17 00:00:00 2001 From: Inderjeet Singh Date: Tue, 11 Nov 2014 02:02:56 +0000 Subject: [PATCH] revised a test to validate that we can query a delegate adapter from typeadapterfactorie registered in JsonAdapter --- .../gson/functional/JsonAdapterAnnotationOnClassesTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gson/src/test/java/com/google/gson/functional/JsonAdapterAnnotationOnClassesTest.java b/gson/src/test/java/com/google/gson/functional/JsonAdapterAnnotationOnClassesTest.java index a697ff8e..b753f289 100644 --- a/gson/src/test/java/com/google/gson/functional/JsonAdapterAnnotationOnClassesTest.java +++ b/gson/src/test/java/com/google/gson/functional/JsonAdapterAnnotationOnClassesTest.java @@ -158,6 +158,11 @@ public final class JsonAdapterAnnotationOnClassesTest extends TestCase { } static final class JsonAdapterFactory implements TypeAdapterFactory { public TypeAdapter create(Gson gson, final TypeToken type) { + + // Ensure that gson.getDelegateAdapter continues to work for type adapter factories + // registered through JsonAdapter annotation. Query for a random type adapter. + gson.getDelegateAdapter(this, TypeToken.get(JsonAdapterAnnotationOnFieldsTest.class)); + return new TypeAdapter() { @Override public void write(JsonWriter out, T value) throws IOException { out.value("jsonAdapterFactory");