I have created a new class which extends a 3rd party abstract class. The new class calls methods in the abstract class. The problem I have is when trying to write the unit test, I'm not sure how to write a test as I would not know the exact details the 3rd party class requires.
The AbstractDecoratorMapper below is a SiteMesh specific class which I have to extend for SiteMesh to work correctly. As far as I can tell from the documentation I can't use composition.
public final class PartnerDecoratorMapper extends AbstractDecoratorMapper {
@Override
public void init(Config config, Properties properties, DecoratorMapper parent) throws InstantiationException {
super.init(config, properties, parent);
}
@Override
public Decorator getDecorator(HttpServletRequest request, Page page) {
if (super.getDecorator(request, page).getName().equalsIgnoreCase("default")) {
return getNamedDecorator(request, "externalPartnerDefault");
}
return super.getDecorator(request, page);
}
}
I use JMock if there is anything this tool can do to help.