How could I unit test a custom decorator which extends AbstractDecoratorMapper

40 views
Skip to first unread message

Ilyas Patel

unread,
Jun 11, 2012, 7:12:46 AM6/11/12
to SiteMesh 3 Users
I have created a new custom decorator which extends a
AbstractDecoratorMapper. The new class calls methods in the abstract
class using super. 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 what
SiteMesh passes to the init methods. I am using JMock if that can help
answer.

Here is the decorator:

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);
}
}



Reply all
Reply to author
Forward
0 new messages