sageserpent-open / americium

Generation of test case data for Scala and Java, in the spirit of QuickCheck. When your test fails, it gives you a minimised failing test case and a way of reproducing the failure immediately.
MIT License
15 stars 1 forks source link

Support automatic derivation of `Trials<X>` for a structured X in Java. #6

Open sageserpent-open opened 3 years ago

sageserpent-open commented 3 years ago

On the Scala side, there is already support for automatic derivation of Trials[X] where X is some algebraic data type that heads a hierarchy of sum and product types - courtesy of Magnolia - nice job there.

What we lack is the same experience on the Java side - and for that matter for classes in Scala that are not sum / product types, ie. 'conventional OO classes in Scala'.

One approach would be to use the public constructors of X to guide the assembly of a Trials<X>, using a mixture of reflection and ByteBuddy for the implementation.

Ideally this should work for both Java and Scala code, although Java is the priority here.