mohan
mohan

Reputation: 1530

Mock an abstract base class using EasyMock

I have an abstract base class (parent) and a derived class (child)

public class child extend parent{
    public void child(...) {
        super(..)
    }
}

public abstract class parent{
   .
   .
   .
}

Here I want to test a public method in child class. And I don't have any dependency in parent class. so I want to mock my abstract parent class. Couldn't find any solid example of doing it. Please share your suggestion.

Upvotes: 3

Views: 1190

Answers (1)

John B
John B

Reputation: 32959

You cannot do this. child is a subclass of parent. You cannot change this. The best you can do is mock all dependancies in parent.

Upvotes: 2

Related Questions