Issue #21 duplicate

Ignore beans

Alexandru Repede
created an issue

I would like to not have to prepare anything I do not need to.

So, when I have multiple beans in the context file I am testing (or, from which I am testing a class), and I do no use them, I want them to be easily (if not automatically) ignored.

Right now, if I have a bean I do not need, and it has collaborators, I have to prepare those collaborators.

If the collaborators are in another context file, I have to setup another context file and use mockito:mock to prepare the mocks for the collaborators of some bean I am not interested in. (Nothing will fail, even with the fake collaborators doing nothing, because that bean is not being tested or called anyhow. It just happens to be in the same context file as the bean under testing)

Or, if the collaborators are in the same context file (with the bean I do not care about), I have to use annotation to replace them with mock in my test file (but these mocks are of no use in my test file, because they are for collaborators of something I am not interested in).

For the last case (if the collaborators are in the same context file), I can also use the xml version with mockito:mock, but still, they have no place in the context file for that test.

Remember this is about a bean that happens to be in the same context file with the bean undert esting.

Comments (2)

  1. Log in to comment