Hi Vincent, 2012/12/10 Vincent Massol <[email protected]>
Hi Jeremie,
On Dec 10, 2012, at 1:22 PM, jerem <[email protected]> wrote:
Hi,
I could workaround that quite easily, by adding the following in my setUp() method, just before retrieving my class under tests from the component manager:
getComponentManager().registerMockComponent(getMockery(), LoggerManager.class);
But it seems to confirm that, for any reason, the LoggerManager was not automatically mocked by AbstractBridgedComponentTestCase.
This is an old/legacy class and you should try to not use it.
I'd prefer not, but as I depend on old core I believe there's no alternative ... Or there is ? By the way I'd prefer not depend on old core but DAB was really too limited for my needs. DAB is ok for very specific use, but for heavy modifications on documents and XObjects api is a bit cumbersome. I wrote a component extending DocumentAccessBridge for my own needs, trying to isolate old core to very limited location in my code, but for now it's not "clean". At the end I think I'll be able to remove AbstractBridgedComponentTestCase for my tests completely.
That said it extends AbstractComponentTestCase which will register in the CM all annotated components it finds in the CP.
The only reason it wouldn't register one component is because it's not in the CP. So either you don't have that dep voluntarily in your pom.xml because it's a runtime dep. You have 2 options: 1) add it as a test dep
It's already in xwiki-commons-logging-api, brought by parent xwiki-commons-pom, in scope compile... When you mean not in CP, you mean the component interface (with @Role) or any concrete implementation class ? I tried to add both (xwiki-commons-logging-api and xwiki-commons-logging-logback in scope test) with same result.
2) do what you've done and mock the component.
Yes I'll stick to that anyway, but I wanted to make sure it was not a symptom of something bad somewhere.
Thanks -Vincent
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Thanks, Jeremie