[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Injecting dependency of superclass into subclass method using aspectJ

Hi,

I am working on a scenario where i have to test a method in a class, whose dependency is with the super class.

For Example:

public SuperClass{

Public ClientFactoryFacade getFactory(){
  
     return factoryFacade;// Some code that returns the factory object
   }

}


Public SubClass extends SuperClass{

    Public void methodUnderTest(){
         
        Collection col = this.getFactory().getPersistenceService().query(); // want to remove this dependency with aspectJ, how to get hold of this.getFactory()
    }
}


I have mock class ready for SuperClass, but struggling for injecting it whenever the test method is called in the subclass, Please suggest on this, happy if some code is there to understand.
--
Thanks,
Bhavuk Soni