0

I use Seam 2.2 and TestNG. I want to test some methods that delete some resources from WebDav using Sardine. The thing is that Sardine throws error if the resources could not be found where expected, so I made a MockSardineTestClass that mocks the actual delete.

The thing is that into my class is being injected a seam component WebDavClient that does the actual resource delete. My MockSardineTestClass extends WebDavClient class and i want to inject the MockSardineTestClass when running tests. How can I accomplish that? Is there a way to do a conditional injection in seam? Do you have another idea?

Also, as a general question: if I have an abstract class/interface with 2 implementations, and with seam I inject that interface how does seam evaluates which implementation should be injected?

spauny
  • 4,976
  • 9
  • 44
  • 61

1 Answers1

0

Annotate your component with @Install(MOCK). Check 5.5. Conditional installation for more information.

The answer for your question is the name of the component. Seam doesn't resolve components by class name but component name.

juanignaciosl
  • 3,435
  • 2
  • 28
  • 28