Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserving hand-written assertions #25

Closed
j-maly opened this issue Dec 18, 2014 · 4 comments
Closed

Preserving hand-written assertions #25

j-maly opened this issue Dec 18, 2014 · 4 comments

Comments

@j-maly
Copy link

j-maly commented Dec 18, 2014

Hi,
if I want to add some assertions of my own (e.g. hasX), how should I do that so that they are not wiped out every time I regenerate the file?

@joel-costigliola
Copy link
Member

Generate the file once, move it to source control and add your assertion manually.
You can generate the assertions again in the future if the domain classes change and transfer any new assertions method to the Assert class you have moved in source control.

@j-maly
Copy link
Author

j-maly commented Dec 18, 2014

So manual merging... when the file is in SC, it is readonly and the maven plugin fails in that case. Would it be possible to add a setting to just continue when the target file is readonly instead of failing? That would allow me to still automatically create the Assertions file (I don't want to merge that one manually).

@joel-costigliola
Copy link
Member

Let the maven plugin generates stuff in target directory, open the generated Assert file and copy the new assertions in the Assert class in source control.

This plugin was meant to quickly start using custom assertions but I always had in mind that once generated they should be moved to source control and enriched with hand written assertions that the generator can't create.

@joel-costigliola
Copy link
Member

The work to keep manually written assertions requires a huge change in the assertion generator as it was not designed with that purpose in mind. I'm closing this issue for that reason, I like the idea though.
Moreover as custom assertions templates are going to be supported, users will be able to generate richer assertions, it does not completely address this issue but should improve things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants