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.
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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.