Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-7450

SessionTestUtil has misleading error messages

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 5.7.2
    • testing
    • None

      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

        Acceptance criteria

              Unassigned Unassigned
              rgange Richard Gange
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:

                  Bug DoR
                  Task DoD