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

Enhance ComponentTestUtils to also support GuiceComponentProvider

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Neutral Neutral
    • 4.5.x
    • None
    • core
    • None

      Right now ComponentTestUtils hardcoded relies on MockComponentProvider. As soon as you e.g. want to use a GuiceComponentProvider you cannot use it any longer.

      Proposal how to do that (by tmattsson):
      @RunWith(MagnoliaPicoRunner.class)
      public class ExampleGuiceTest {

      @ConfigureComponents
      public void configureComponents(GuiceComponentProvider provider)

      { ModuleRegistry moduleRegistry = mock(ModuleRegistry.class); when(moduleRegistry.getModuleNames()).thenReturn(new HashSet<String>()); provider.registerInstance(ModuleRegistry.class, moduleRegistry); }

      @Inject
      private ModuleRegistry moduleRegistry;

      @Test
      public void testSomething()

      { assertTrue(moduleRegistry.getModuleNames().isEmpty()); }

      }

        Acceptance criteria

              Unassigned Unassigned
              dlipp Daniel Lipp
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD