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

ComponentsTestUtil causes failures with @MagnoliaRepositoryTest

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 6.2.16
    • None
    • testing

      Steps to reproduce

      Call ComponentsTestUtil.clear() in an @AfterEach method in a @MagnoliaRepositoryTest annotated test.

      Expected results

      All existing tests pass.

      Actual results

      All tests fail:

      info.magnolia.objectfactory.MgnlInstantiationException: No concrete implementation defined for interface info.magnolia.context.SystemContext
      at info.magnolia.test.mock.AbstractComponentProvider.getComponent(AbstractComponentProvider.java:157) ~[test-classes/:?]
      at info.magnolia.objectfactory.Components.getComponent(Components.java:107) ~[classes/:?]
      at info.magnolia.context.ContextFactory.getSystemContext(ContextFactory.java:63) ~[classes/:?]
      at info.magnolia.context.MgnlContext.getSystemContext(MgnlContext.java:347) ~[classes/:?]
      at info.magnolia.context.MgnlContext.release(MgnlContext.java:615) ~[classes/:?]
      at info.magnolia.test.juni5.RepositorySupport.afterEach(RepositorySupport.java:115) ~[test-classes/:?] 

      Development notes

      ComponentsTestUtil.clear() interferes with the setup/tear down of the extensions. This is a problem of ComponentsTestUtil.clear() being too intrusive violating JUnit 5's "wrapping behaviour". (For the same reason ComponentsTestUtil.clear() needs to be placed after super.tearDown() instead of before currently). IMO this needs to fixed in ComponentsTestUtil by introducing means for resetting the component provider to its previous state instead of just clearing it.

        Acceptance criteria

              mduerig Michael Duerig
              mduerig Michael Duerig
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD