HttpContextFactoryServiceImpl implements HttpContextFactoryService { @Override public HttpContext createDefaultHttpContext(Bundle bundle) { return httpContext.wrap(bundle); }  @Override HttpContext createDefaultHttpContext(Bundle bundle); @Reference(policy = ReferencePolicy.DYNAMIC) void setHttpContext(WrappingHttpContext httpContext); void unsetHttpContext(WrappingHttpContext httpContext);  }
@Test public void shouldCreateHttpContext() { HttpContext context = httpContextFactoryService.createDefaultHttpContext(bundle); assertThat(context, is(notNullValue())); verify(httpContext).wrap(bundle); }
@Test public void httpContextShouldCallgetResourceOnBundle() { HttpContext context = httpContextFactoryService.createDefaultHttpContext(bundle); context.getResource(RESOURCE); verify(httpContext).wrap(bundle); verify(bundle).getResource(RESOURCE); }
@Test public void httpContextShouldCallgetResourceOnBundleWithoutLeadingSlash() { HttpContext context = httpContextFactoryService.createDefaultHttpContext(bundle); context.getResource("/" + RESOURCE); verify(httpContext).wrap(bundle); verify(bundle).getResource(RESOURCE); }