Open full view…

Use @Spy by default

Mon, 24 Jun 2019 02:54:45 GMT

Is there a way to make fields marked with @Spy by default instead of @Mock ?

Mon, 24 Jun 2019 11:21:52 GMT

Unfortunately such feature not supported yet. It's not enough to replace the @Mock annotation into @Spy for a functional UT since @Spy members need to be initialized. It's do-able but more complicated. On the other hand there might be some value here as a starter template, while having to hand write the initialization code from a better starting point without having to replace the @Mock annotations with @Spy. I think this use case falls into the growing need to support user customized templates.