Announcement Announcement Module
Collapse
No announcement yet.
usage of the test classes in the mock jar Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • usage of the test classes in the mock jar

    Hi,

    I have some trouble using AbstractSpringContextTests and its subclasses.
    In my context files, I have a proxy for each service to declare my transaction attributes.

    It seems that, with this configuration, I cannot use autowiring by type because I have two beans in my context that extends my interface : my target bean and my proxy : Is that true ? If yes I think this mode is pretty useless because declaring proxies for services is usual.

    So I am trying the second mode : autowire by name.

    It seems that I have to declare my attributes public but not protected to make this mode works. I saw a correction in the cvs tree so I guess the next version will correct it

    For this mode, I have to redefine the method initManagedVariables like this
    Code:
    public class TestFabriqueInterceptor extends AbstractDependencyInjectionSpringContextTests
    {
        public Service service;
        public TestFabriqueInterceptor()
        {
            setPopulateProtectedVariables(true);
        }
        protected void initManagedVariableNames()
        {
            managedVariableNames = new String[] {"service"};
        }
    ...
    }
    Is that the correct usage ? If yes, I think the javadoc is not very explicit. And I also think that redifining a method that returns an array of String would be better

    To finish I also want to say that I find this package very useful for unit testing my services

    Great job

    Seb
Working...
X