|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Object grails.test.mixin.support.GrailsUnitTestMixin grails.test.mixin.domain.DomainClassUnitTestMixin
class DomainClassUnitTestMixin extends GrailsUnitTestMixin
A mixin that can be applied to JUnit or Spock tests to add testing support to a users test classes. Can be used in combination with ControllerUnitTestMixin to fully test controller interaction with domains without needing a database
The majority of GORM features are mocked by this unit test mixin including:
Mocking can be applied to any domain class by simply calling the DomainClassUnitTestMixin.mockDomain method
Field Summary | |
---|---|
protected org.grails.datastore.mapping.core.Session |
currentSession
|
Property Summary | |
---|---|
static org.grails.datastore.mapping.simple.SimpleMapDatastore |
simpleDatastore
|
static org.springframework.transaction.PlatformTransactionManager |
transactionManager
|
Method Summary | |
---|---|
static void
|
cleanupDatastore()
|
void
|
connectDatastore()
|
protected void
|
enhanceSingleEntity(org.grails.datastore.mapping.model.PersistentEntity entity)
|
protected void
|
initialMockDomainSetup()
|
static void
|
initializeDatastoreImplementation()
|
java.lang.Object
|
mockDomain(java.lang.Class domainClassToMock, java.util.List domains = [])
Mocks a domain class providing the equivalent GORM behavior but against an in-memory concurrent hash map instead of a database |
java.lang.Object
|
mockDomains(java.lang.Class... domainsClassToMock)
|
protected org.springframework.validation.Validator
|
registerDomainClassValidator(GrailsDomainClass domain)
|
protected GrailsDomainClass
|
registerGrailsDomainClass(java.lang.Class domainClassToMock)
|
protected void
|
saveDomainList(org.grails.datastore.mapping.model.PersistentEntity entity, java.util.List domains)
|
void
|
shutdownDatastoreImplementation()
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected org.grails.datastore.mapping.core.Session currentSession
Property Detail |
---|
static org.grails.datastore.mapping.simple.SimpleMapDatastore simpleDatastore
static org.springframework.transaction.PlatformTransactionManager transactionManager
Method Detail |
---|
@AfterClass static void cleanupDatastore()
@Before void connectDatastore()
protected void enhanceSingleEntity(org.grails.datastore.mapping.model.PersistentEntity entity)
protected void initialMockDomainSetup()
@BeforeClass static void initializeDatastoreImplementation()
java.lang.Object mockDomain(java.lang.Class domainClassToMock, java.util.List domains = [])
domainClassToMock
- The domain class to mock
java.lang.Object mockDomains(java.lang.Class... domainsClassToMock)
protected org.springframework.validation.Validator registerDomainClassValidator(GrailsDomainClass domain)
protected GrailsDomainClass registerGrailsDomainClass(java.lang.Class domainClassToMock)
protected void saveDomainList(org.grails.datastore.mapping.model.PersistentEntity entity, java.util.List domains)
@After void shutdownDatastoreImplementation()
Groovy Documentation