@Test public void acceptsParcelableProperties() throws Exception { TypeElement type = elements.getTypeElement(SampleTypeWithParcelable.class.getCanonicalName()); AutoValueExtension.Context context = createContext(type); String generated = extension.generateClass( context, "Test_TypeWithParcelable", "SampleTypeWithParcelable", true); assertThat(generated).isNotNull(); }
@Test public void throwsForNonParcelableProperty() throws Exception { TypeElement type = elements.getTypeElement(SampleTypeWithNonSerializable.class.getCanonicalName()); AutoValueExtension.Context context = createContext(type); try { extension.generateClass(context, "Test_AnnotatedType", "SampleTypeWithNonSerializable", true); fail(); } catch (AutoValueParcelException e) { } }