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

NoSuchBeanDefinitionException thrown in unit tests #203

Closed
4 tasks done
andrewcanby-finocomp opened this issue Jun 30, 2020 · 1 comment
Closed
4 tasks done

NoSuchBeanDefinitionException thrown in unit tests #203

andrewcanby-finocomp opened this issue Jun 30, 2020 · 1 comment

Comments

@andrewcanby-finocomp
Copy link

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

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

  • Operating System: Mac 10.15.5
  • GORM Version: 7.0.4.RELEASE
  • Grails Version (if using Grails): 4.0.3
  • JDK Version: 8.0.252-zulu

Example Application

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

@robertoschwald
Copy link
Member

Thanks for the report. Will look into it.

robertoschwald added a commit that referenced this issue Jun 30, 2020
fixes #203 prevent exception if AuditRequestResolverBean is not initialized
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