gpc / grails-audit-logging-plugin

The Grails Audit Logging Plugin
Apache License 2.0
50 stars 60 forks source link

NoSuchBeanDefinitionException thrown in unit tests #203

Closed andrewcanby-finocomp closed 4 years ago

andrewcanby-finocomp commented 4 years ago

Task List

Steps to Reproduce

  1. Add Auditable to a domain
  2. Implement/override the clone() method for a domain, selectively omitting properties
  3. Unit test the clone method and see the exception

Full details in linked example application.

Expected Behaviour

An exception should not be thrown when there is no AuditRequestResolver bean provided, instead the default fallback behaviour should be used (a default String etc.)

Actual Behaviour

While unit testing myDomainInstance.clone() a NoSuchBeanDefinitionException is thrown once Auditable is added to the Domain class. Note that this is not the only time it is an issue, but the simplest way to reproduce.

This will likely only manifest as a test issue, given the plugin explicitly registers the bean on application startup.

Environment Information

Example Application

https://github.com/andrewcanby-finocomp/audit-bean-in-tests

robertoschwald commented 4 years ago

Thanks for the report. Will look into it.