I'm trying to figure out the best way of writing a unit test for an overridden method which calls super() as the last step. Basically, I want to massage parameters before they're used in the base class.
Here's an example of a method:
@Override
public JobExecution run(Job job, JobParameters passedParams)
throws JobExecutionAlreadyRunningException, JobRestartException {
JobParameters launchParameters;
if(passedParams.isEmpty()) {
launchParameters = jobParameterSetter.getJobParameters();
} else {
launchParameters = passedParams;
}
return super.run(job, launchParameters);
}
What it comes down to is that I can't find a seam to check the parameters that are in the eventual super.run() call, which is all I want to test. The base class has several dependencies, and it's really not necessary to test that class (not to mention a lot more work).
Composition is a solution, but it's a fairly complicated base class and I need to expose the whole thing while only overriding a couple of methods.
I'm also considering faking the base class for testing, which is simple enough, but I'm not sure how to change the classpath just for running the unit test (Eclipse for single tests; Maven for build testing -- maybe a question on its own?).
I have to imagine this has already been asked, but I can't find an exact match.