I know that method with the private access can be tested using 1. reflection or 2. powermockito but how do you test default class with private methods and the parent class is abstract?
class AirSpaceBuilder extends SynchronizedSpace {
private Request request;
private Status status;
public AirSpaceBuilder (Log log, SpaceTable st, Collection locks, SpaceRequest request) {
super(log, st, locks, request.getAirSpace());
this.request = request;
}
private Status recursiveSignal() {
...
}
abstract class SynchronizedSpace {
private Collection sync;
private String requester;
private SpaceTable st;
private Log log;
...
}
My first thought was to call it from the higher level but then it becomes integrated test and defeated the purpose of unit testing.
Edit: Correct me if I am wrong but is this how you invoke the method?
Object airSpaceBuilder=Class.forName("com.airport.resource.AirSpaceBuilder").newInstance();
Method m = airSpaceBuilder.getClass().getDeclaredMethod("recursiveSignal");
m.setAccessible(true);
m.invoke(allocationFunction);