How do you write tests against @Mutate, @Model, and other rules? I see that internally, Gradle unit tests casts the Project instance returned by ProjectBuilder to ProjectInternal, and then use the getModelRegistry() to realize and tests the rules.
What is the recommended way for plugin authors to write these tests? If it is to use the ProjectInternal (at least for now), what is the recommended way in the future?
This is basically the question asked here. Yes, I’d say this is really the only way to do unit testing right now. There is a possibility we’ll add better fixture support here.
Your other alternative is to use functional testing via TestKit for this and embed your assertions in an actual task.
Excuse my intervention here. I really didn’t study the new model effectively, but just gave it some glimpse in the user manual. My first impressions always are: why does the manual describe the new model using non build types like ‘Person’? Why doesn’t it describe itself in terms and notions of build objects?