use of org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap in project resteasy by resteasy.
the class ContextParameterInjectionTest method createProxy.
private Object createProxy() {
ServletContext mockServletContext = mock(ServletContext.class);
when(mockServletContext.getAttribute(ResteasyDeployment.class.getName())).thenReturn(null);
ConfigurationBootstrap configBootstrap = new ListenerBootstrap(mockServletContext);
ResteasyContext.pushContext(ResteasyDeployment.class, configBootstrap.createDeployment());
try {
final Class<ContainerRequestFilter> filterClass = ContainerRequestFilter.class;
final ContainerRequestFilter coolInstance = new CoolFilter();
ResteasyProviderFactory mockFactory = mock(ResteasyProviderFactory.class);
when(mockFactory.getContextData(filterClass, filterClass, null, false)).thenReturn(coolInstance);
ResteasyProviderFactory.setInstance(mockFactory);
ContextParameterInjector cpi = new ContextParameterInjector(null, filterClass, filterClass, null, mockFactory);
return cpi.createProxy();
} finally {
ResteasyContext.removeContextDataLevel();
}
}
Aggregations