Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-7227

In JUnit4 tests when using CoreFeature - Granularity=METHOD is not working as expected

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 5.6
    • Component/s: Tests

      Description

      In fact because the CoreSession Guice provider is installed in scope Singleton the same session is reused even if the
      Granularity=METHOD is used in tets annotations.
      This can lead to weird behavior.

      This can be fixed by simply replacing:

      protected <T> void bind0(Binder binder, Class<T> type, Provider<T> provider)

      { binder.bind(type).toProvider(provider).in(Scopes.SINGLETON); }

      with

      protected <T> void bind0(Binder binder, Class<T> type, Provider<T> provider)

      { binder.bind(type).toProvider(provider); }

      in class org.nuxeo.runtime.test.runner.RuntimeFeature

      but should be tested before to be sure existing tests are not broken by the modification

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: