ppi-ag / deep-sampler

DeepSampler is a stubbing framework for compound tests
https://ppi.de
MIT License
11 stars 2 forks source link

Add support for Optional #109

Closed JanSchankin closed 2 years ago

JanSchankin commented 2 years ago

Currently Optionals cannot be persisted. An attempt to do this results in the following Exception:

de.ppi.deepsampler.persistence.error.PersistenceException: The type class java.util.Optional includes at least one final field. Therefore we tried to automatically detect a constructor accepting all field values, but weren't able to find any. If you still want to transform the bean you have to implement a BeanFactoryExtension which is able to construct the desired type class java.util.Optional.

Since Optional is part of standard Java and quite common, DeepSampler should bring it's own BeanFactoryExtension, so that no custom implementations are necessary.