Fix test case
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1656079 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java b/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
index caebc67..d845bb2 100644
--- a/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
+++ b/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
@@ -48,8 +48,11 @@
import org.apache.felix.http.jetty.internal.JettyService.Deployment;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.ServletHolder;
+import org.mockito.Matchers;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.Version;
public class JettyServiceTest extends TestCase
@@ -85,6 +88,10 @@
when(mockBundle.getSymbolicName()).thenReturn("main");
when(mockBundle.getVersion()).thenReturn(new Version("1.0.0"));
when(mockBundle.getHeaders()).thenReturn(new Hashtable<String, String>());
+ final ServiceRegistration reg = mock(ServiceRegistration.class);
+ when(mockBundleContext.registerService((Class)Matchers.isNotNull(),
+ Matchers.any(ServiceFactory.class),
+ Matchers.any(Dictionary.class))).thenReturn(reg);
httpServiceController = new HttpServiceController(mockBundleContext);
dispatcherServlet = new DispatcherServlet(httpServiceController);
@@ -138,11 +145,13 @@
//Add a Filter to test whether the osgi-bundlecontext is available at init
webAppBundleContext.addServlet(new ServletHolder(new Servlet()
{
+ @Override
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
// Do Nothing
}
+ @Override
public void init(ServletConfig config) throws ServletException
{
ServletContext context = config.getServletContext();
@@ -152,16 +161,19 @@
testLatch.countDown();
}
+ @Override
public String getServletInfo()
{
return null;
}
+ @Override
public ServletConfig getServletConfig()
{
return null;
}
+ @Override
public void destroy()
{
// Do Nothing
@@ -170,6 +182,7 @@
webAppBundleContext.addFilter(new FilterHolder(new Filter()
{
+ @Override
public void init(FilterConfig filterConfig) throws ServletException
{
ServletContext context = filterConfig.getServletContext();
@@ -179,11 +192,13 @@
testLatch.countDown();
}
+ @Override
public void doFilter(ServletRequest arg0, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
// Do Nothing
}
+ @Override
public void destroy()
{
// Do Nothing