Hi all,

I wondered if anyone had any experience of using PowerMock in Magnolia, 
specifically utilising RepositoryTestCase or MgnlTestCase.

My tests run fine using mockito, but when using powermock and trying to mock a 
static class (e.g. MessagesManager) using the annotations: 
@RunWith(PowerMockRunner.class)
@PrepareForTest(info.magnolia.cms.i18n.MessagesManager.class)

I get all sorts of problems regarding the underlying initialisation of 
Magnolia, e.g.

[quote]
java.lang.IllegalStateException: No ComponentProvider has been set yet, 
something must have gone terribly wrong at startup.
        at 
info.magnolia.objectfactory.Components$NullComponentProvider.getComponent(Components.java:108)
        at 
info.magnolia.objectfactory.Components.getComponent(Components.java:96)
        at 
info.magnolia.context.ContextFactory.getInstance(ContextFactory.java:72)
        at 
info.magnolia.context.MgnlContext.getSystemContext(MgnlContext.java:362)
        at info.magnolia.context.MgnlContext.release(MgnlContext.java:622)
        at 
info.magnolia.test.RepositoryTestCase.shutdownRepository(RepositoryTestCase.java:181)
        at 
info.magnolia.test.RepositoryTestCase.tearDown(RepositoryTestCase.java:170)
[/quote]

Which, considering it runs via the Mockito runner, should all be setup and 
working.

Obviously I'm running super.setup() in my @Before method.

Cheers,

Dean

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=1d93977c-8d00-4026-90c4-a0b25f1aa45d


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to