Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

TypeRemark
ComponentsTestUtil

Set default implementations or instances when IoC can't be used yet.

MgnlTestCaseSets up a basic environment for the test, loads beans and modules properties and initializes a mock context as the local context.
RepositoryTestCaseSuperclass for Tests requiring access to a real jcr repo.
MockUtilUtil to create mock objects - especially MockContexts.
MockContextContext where you can add Sessions and set a User
MockNodeMock implementation of a jcr Node
MockContentMockImplemenation 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 SetupSpecificsPreferred ApproachRemark
Class under tests operates on JCR Nodeonly few calls to the Nodeuse Mockito mock 
 need a simple hierarchy of Nodesdirectly use MockNode() 
 need a simple hierarchy of Nodes but with several propertiesuse SessionTestUtil to instantiate MockSession + MockNodes from propertiesStream or String 
 need a complex hierarchy of Nodes, real NodeTypes or issue real queriesuse RepositoryTestCase