Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Incomplete
-
Affects Version/s: 2.0.1
-
Fix Version/s: None
-
Component/s: Testing
-
Labels:None
-
Testcase included:yes
Description
Given a POGO base class that expresses constraints (e.g. it is the parent of both a domain and @Validateable class):
src/groovy/bug/Parent.groovy
package bug class Parent { String lastName static constraints = { lastName(nullable: false) } }
And a domain class that extends from it:
domain/bug/Child.groovy
package bug class Child extends Parent { String firstName static constraints = { firstName(nullable: false) } }
A unit test that uses the new '@TestFor(Child)' style fails with the following exception:
Mapped identifier [id] for class [bug.Parent] is not a valid property org.grails.datastore.mapping.model.IllegalMappingException: Mapped identifier [id] for class [bug.Parent] is not a valid property at org.grails.datastore.mapping.model.config.GormMappingConfigurationStrategy.getIdentity(GormMappingConfigurationStrategy.java:740) at org.grails.datastore.mapping.model.AbstractPersistentEntity.resolveIdentifier(AbstractPersistentEntity.java:117) at org.grails.datastore.mapping.model.AbstractPersistentEntity.initialize(AbstractPersistentEntity.java:83) at org.grails.datastore.mapping.model.AbstractMappingContext.addPersistentEntityInternal(AbstractMappingContext.java:150) at org.grails.datastore.mapping.model.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:135) at org.grails.datastore.mapping.model.AbstractPersistentEntity.initialize(AbstractPersistentEntity.java:104) at org.grails.datastore.mapping.model.AbstractMappingContext.addPersistentEntityInternal(AbstractMappingContext.java:150) at org.grails.datastore.mapping.model.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:135) at grails.test.mixin.domain.DomainClassUnitTestMixin.mockDomain(DomainClassUnitTestMixin.groovy:132) at grails.test.mixin.domain.DomainClassUnitTestMixin.mockDomain(DomainClassUnitTestMixin.groovy:128)
The old-style unit test passes.
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
Graeme Rocher
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Resolution | Incomplete [ 4 ] | |
| Status | Open [ 1 ] | Closed [ 6 ] |