system object of interface type inside another system object

Help
Michal
2014-07-29
2014-08-05
  • Michal
    Michal
    2014-07-29

    Hi, I have the following example:

    public class ParentSystemObj extends SystemObjectImpl {
    
    public MyInterface anotherSystemObj;
    
        public MyInterface getAnotherSystemObj() {
        return anotherSystemObj;
    }
    
    public void setAnotherSystemObj(MyInterface anotherSystemObj) {
        this.anotherSystemObj= anotherSystemObj;
    }
    }
    

    This is the SUT:

    <parent>
        <class>com.something.ParentSystemObj</class>
        <anotherSystemObj>
            <class>com.something.MyInterfaceImpl</class>
        </anotherSystemObj>
    </parent>
    

    The type of my internal system object (anotherSystemObj) is an interface. When I try to run a test the anotherSystemObj does not go through init by the framework eventhough I provide an actual class (not interface) in the SUT. Is there any way to get this to work without providing an actual/abstract class in the member type in the code itself inside the parent system object class?

    BTW, if I try to the same but not a system object inside another one, i.e. in the test layer I have:

    MyInterface anotherSystemObj;
    anotherSystemObj= (MyInterface) system.getSystemObject("anotherSystemObj");
    

    This works, but I want the system object to be inside another one, not by itself

     
  • Michal
    Michal
    2014-08-05

    Anyone?

     
  • Hovav
    Hovav
    2014-08-05

    AFAIK it should work but there are too few details to tell.
    in the past we used a base class that derived from SystemObjectImpl and not as an implementor of SystemObject - can you please prepare a simple project that reproduces it?