Page History
...
Type | Remark |
---|---|
ComponentsTestUtil | Set default implementations or instances when IoC can't be used yet. |
MgnlTestCase | Sets up a basic environment for the test, loads beans and modules properties and initializes a mock context as the local context. |
RepositoryTestCase | Superclass for Tests requiring access to a real jcr repo. |
MockUtil | Util to create mock objects - especially MockContexts. |
MockContext | Context where you can add Sessions and set a User |
MockNode | Mock implementation of a jcr Node |
MockContent | MockImplemenation of a Content |
What to choose when
Here's a few examples that should help to understand what approach should preferably be used in what situation:
General Setup | Specifics | Preferred Approach | Remark |
---|---|---|---|
Class under tests operates on JCR Node | only few calls to the Node | use Mockito mock | |
need a simple hierarchy of Nodes | directly use MockNode() | ||
need a simple hierarchy of Nodes but with several properties | use SessionTestUtil to instantiate MockSession + MockNodes from propertiesStream or String | ||
need a complex hierarchy of Nodes, real NodeTypes or issue real queries | use RepositoryTestCase |
Overview
Content Tools