[MAGNOLIA-7450] SessionTestUtil has misleading error messages Created: 29/Jan/19  Updated: 29/Jan/19

Status: Open
Project: Magnolia
Component/s: testing
Affects Version/s: 5.7.2
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Richard Gange Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

Using the guide here: https://wiki.magnolia-cms.com/display/DEV/JCR+Mocks

Assume we have a file called navigationFunctionsTest.properties:

classic.@type = mgnl:page
classic/article0.@type = mgnl:page
classic/article0/articleSub.@type = mgnl:page
classic/article0/articleSub0.@type = mgnl:page
classic/article0/articleSub0/articleSubSub.@type = mgnl:page

If we use this code to read it:

SessionTestUtil.createSession("test", getClass().getResourceAsStream("/navigationFunctionsTest.properties"));

Leads to this error:

java.lang.IllegalArgumentException: Missing trailing '/' for key: classic.@typejava.lang.IllegalArgumentException: Missing trailing '/' for key: classic.@type
{{ at info.magnolia.jcr.util.PropertiesImportExport.keysToInnerFormat(PropertiesImportExport.java:117) at info.magnolia.jcr.util.PropertiesImportExport.createNodes(PropertiesImportExport.java:84) at info.magnolia.test.mock.jcr.NodeTestUtil.createSubnodes(NodeTestUtil.java:76) at info.magnolia.test.mock.jcr.SessionTestUtil.createSession(SessionTestUtil.java:94) at de.db.vendo.cms.functions.NavigationFunctionsTest.setUp(NavigationFunctionsTest.java:22) at junit.framework.TestCase.runBare(TestCase.java:139)}}

Here is a working sample: https://git.magnolia-cms.com/projects/MODULES/repos/categorization/browse/magnolia-categorization/src/test/resources/categortyNodeTree.properties


Generated at Mon Feb 12 04:23:53 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.