Closed paulhoadley closed 6 years ago
Hi Paul,
Not calling validateForInsert
when the object is new is certainly a bug. The second option sounds like the correct fix.
I've been very busy lately, but I'm planning to make a revamped WOUnit version compatible with JUnit 5 in the future. Anyway, I'm glad to make new releases of WOUnit with bug fixes if required.
I'm planning to make a revamped WOUnit version compatible with JUnit 5 in the future.
Sounds great! Any chance of bumping up to Wonder 7 at the same time? I currently run a custom build of WOUnit because of a binary incompatibility issue there, but it would be great to come back to a mainline release.
Certainly, I'll make a release of WOUnit compatible with Wonder 7. We just need to make a release of Wonder 7 before that. :)
I have an EO that splits some save-time validation logic between
validateForSave()
andvalidateForInsert()
, with the latter method being called just for new objects. I can't test this using something likeconfirm(eo, canBeSaved())
, becauseCanBeSavedMatcher.matchesWithPossibleException()
only callsvalidateForSave()
. Obviously I could test it directly by callingvalidateForInsert()
, but could we get WOUnit to do this for us? I see a couple of possibilities:CanBeInsertedMatcher
.validateForInsert()
toCanBeSavedMatcher.matchesWithPossibleException()
on the condition thatisNewObject()
was true.Would either of these approaches be suitable, and which would be preferred? I am happy to do the work and open a PR, though it's not clear whether WOUnit development is ongoing—let me know!