package com.vimeo.sample;

import android.support.annotation.NonNull;

import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.reflect.TypeToken;
import com.vimeo.sample.stag.generated.Stag;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

/**
 * Utils class for testing type adapter generation.
 *
 * Created by restainoa on 1/30/17.
 */
public final class Utils {

    private Utils() {
    }

    private static <T> TypeAdapter<T> getTypeAdapter(@NonNull Class<T> clazz) {
        Gson gson = new Gson();
        Stag.Factory factory = new Stag.Factory();
        TypeToken<T> innerModelType = TypeToken.get(clazz);
        return factory.create(gson, innerModelType);
    }

    /**
     * Verifies that a TypeAdapter was generated for the specified class.
     *
     * @param clazz the class to check.
     * @param <T>   the type of the class, used internally.
     * @throws Exception throws an exception if an adapter was not generated.
     */
    public static <T> void verifyTypeAdapterGeneration(@NonNull Class<T> clazz) throws Exception {
        TypeAdapter<T> typeAdapter = getTypeAdapter(clazz);
        assertNotNull("Type adapter was not generated by Stag", typeAdapter);
    }

    /**
     * Verifies that a TypeAdapter was NOT generated for the specified class.
     *
     * @param clazz the class to check.
     * @param <T>   the type of the class, used internally.
     * @throws Exception throws an exception if an adapter was generated.
     */
    public static <T> void verifyNoTypeAdapterGeneration(@NonNull Class<T> clazz) throws Exception {
        TypeAdapter<T> typeAdapter = getTypeAdapter(clazz);
        assertNull("Type adapter was not generated by Stag", typeAdapter);
    }

}

@@ -62,16 +62,60 @@
 NonNull;
+%0Aimport android.support.annotation.Nullable;
 %0A%0Aimport
@@ -409,16 +409,20 @@
 tion.%0A *
+ %3Cp%3E
 %0A * Crea
@@ -507,24 +507,38 @@
 () %7B%0A    %7D%0A%0A
+    @Nullable%0A
     private 

Add missing nullable annotation