icfnext / prosper

A Spock-based integration testing library for prosperous AEM development.
Other
28 stars 19 forks source link

addModelsForPackage Issue #9

Closed MaartenTutak closed 7 years ago

MaartenTutak commented 7 years ago

Hi,

I'm currently experimenting with Prosper, and I have the following issue. Adapting a resource to a Sling Model is not working, eventhough the following call has been made.

slingContext.addModelsForPackage("be.tutak.jcr.example.entity")

example code

Any ideas ? Thanks!

markdaugherty commented 7 years ago

The first thing I would try is moving that line to the setupSpec block to see if that works - this is typically where I register the models in my specs, although I will look into why it's not working in feature methods.

MaartenTutak commented 7 years ago

I tried moving it to the setupSpec block, but that didn't do the trick either.

MaartenTutak commented 7 years ago

Ugh, I figured it out.. My Sling Model doesn't have a default constructor. I found out after digging around and finding the following exception.

org.apache.sling.models.factory.ModelClassException: Unable to find a useable constructor for model class be.tutak.jcr.example.entity.ProductEntity

My bad, thanks for your time.

markdaugherty commented 7 years ago

Glad you found the problem, thanks for updating!