[ http://jira.magnolia.info/browse/MAGNOLIA-1452?page=all ]

Philipp Bracher resolved MAGNOLIA-1452.
---------------------------------------

    Resolution: Fixed
      Assignee: Philipp Bracher  (was: Boris Kraft)

I checked in first mock objects found in the package info.magnolia.test.mock
- MockContent
- MockNodeData
- MockHierarchyManager
- MockContext

Use the MockUtil to build a mock hierarchy easily.

MockUtil.initMockContext()
MockUtil.createHierarchyManager(properties)

The properties String or Stream you provide defines the node properties, types 
and uuids.

Here follows an example:

parent.type = mgnl:test
parent.uuid = 1
parent.prop1 = value1
parent.prop2 = value2
parent.prop3 = boolean:true

parent.sub1.type = mgnl:sub
parent.sub1.uuid = 2
parent.sub1.prop1 = sub1value1
parent.sub1.prop2 = sub1value2
parent.sub1.prop3 = boolean:true

parent.sub2.type = mgnl:sub
parent.sub2.uuid = 3
parent.sub2.prop1 = sub2value1
parent.sub2.prop2 = sub2value2
parent.sub2.prop3 = boolean:false

hm.getContent("/parent/sub1").getNodeData("prop3").getBoolean() --> true

> testing: mock objects for content
> ---------------------------------
>
>                 Key: MAGNOLIA-1452
>                 URL: http://jira.magnolia.info/browse/MAGNOLIA-1452
>             Project: Magnolia
>          Issue Type: Improvement
>            Reporter: Philipp Bracher
>         Assigned To: Philipp Bracher
>             Fix For: 3.1
>
>
> I started to write mock Content, NodeData objects. They can be used for 
> writing tests.
> The goal is to write a util class transforming a properties file to a content 
> structure.
> This facilitates writing test (mainly for configuration and similar) a lot

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia.info/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------

Reply via email to