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

SessionTestUtil has misleading error messages

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.7.2
    • Fix Version/s: None
    • Component/s: testing
    • Labels:
      None

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: