Apollo-android: Builders for generated models for testing purposes?

Created on 2 Oct 2017  路  1Comment  路  Source: apollographql/apollo-android

Would it be possible to have Builders generated for each of the generated model classes? E.g. something like AutoValue with Builders or the copy() method for data classes in Kotlin.

The reason I ask is for ease of unit-testing. I'm attempting to test that an Apollo-generated model is mapped correctly to a domain model on a per-field basis rather than all in one go. As far as I can tell this will be difficult to achieve currently without writing a lot of boilerplate (e.g. creating a builder by hand), which undermines the biggest benefit of using Apollo to begin with.

If there are alternative approaches to unit-testing Apollo-model mappers that people have discovered, I'd be very interested to hear them. Cheers

Question

Most helpful comment

we have such option:

apollo {
generateModelBuilder = true
}

>All comments

we have such option:

apollo {
generateModelBuilder = true
}
Was this page helpful?
0 / 5 - 0 ratings