« Return to Thread: Mocking concrete class via constructor call

Mocking concrete class via constructor call

by Sam Khan :: Rate this Message:

Reply to Author | View in Thread

Hi,

I remember reading somewhere that it was possible to create a mock of a concrete
class while calling (and providing the relevant arguments to) a particular
constructor. I know I'm veering off the JMock path here but I'm hamstrung by not
being able to extract and then mock interfaces (due to various reasons). For
example, if I have the following class and constructor , can I mock it?

public Resource {

    public Resource(int param1, MyClass param2){
        this.param1 = param1;
        this.param2 = param2;
    }
}

Thanks,
Sam


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Mocking concrete class via constructor call