Hi folks,
what is the best strategy to have unit tests for Fortress components? My first
approach was to run through the lifecycle, but I need a lot of mock objects:
public void testComponent() throws Exception {
try {
ServletContainer lContainer = new ServletContainer();
// Initialization phase
ContainerUtil.enableLogging(lContainer, new NullLogger());
ContainerUtil.contextualize(lContainer, m_Context);
ContainerUtil.service(lContainer, new DefaultServiceManager());
ContainerUtil.configure(lContainer, new DefaultConfiguration("test"));
ContainerUtil.initialize(lContainer);
ContainerUtil.start(lContainer);
// Destruction phase
ContainerUtil.stop(lContainer);
ContainerUtil.dispose(lContainer);
}
catch (ContextException e) {
fail("Container contextualization.");
}
catch (ServiceException e) {
fail("Container service.");
}
catch (ConfigurationException e) {
fail("Container configuration.");
}
}
Test fails at the DefaultServiceManager, since it is not properly initialized. So what
do you do testing your components?
Regards,
J�rg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]