package ro.isdc.wro.extensions.http.handler.spi;

import static org.junit.Assert.assertFalse;
import static org.mockito.MockitoAnnotations.initMocks;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;

import ro.isdc.wro.config.Context;
import ro.isdc.wro.http.handler.RequestHandler;
import ro.isdc.wro.util.WroTestUtils;

/**
 * @author Alex Objelean
 */
public class TestDefaultRequestHandlerProvider {
  @Mock
  private HttpServletRequest mockRequest;
  private DefaultRequestHandlerProvider victim;
  @Before
  public void setUp() {
    initMocks(this);
    Context.set(Context.standaloneContext());
    victim = new DefaultRequestHandlerProvider();
    WroTestUtils.createInjector().inject(victim);
  }

  @Test
  public void shoudProvideAtLeastOneRequestHandler() {
    final Map<String, RequestHandler> map = victim.provideRequestHandlers();
    assertFalse(map.isEmpty());
  }

  @Test
  public void shouldNotFailWhenEachHandlerIsInvoked() {
    final Map<String, RequestHandler> map = victim.provideRequestHandlers();
    for(final RequestHandler handler : map.values()) {
      handler.accept(mockRequest);
      handler.isEnabled();
    }
  }
}

@@ -371,16 +371,67 @@
 andler;%0A
+import ro.isdc.wro.model.group.processor.Injector;%0A
 import r
@@ -460,16 +460,16 @@
 tUtils;%0A
-
 %0A/**%0A * 
@@ -641,16 +641,45 @@
 victim;%0A
+  private Injector injector;%0A
   @Befor
@@ -771,16 +771,62 @@
 ext());%0A
+    injector = WroTestUtils.createInjector();%0A
     vict
@@ -875,37 +875,16 @@
     
-WroTestUtils.createI
+i
 njector
-()
 .inj
@@ -1215,24 +1215,24 @@
 Handlers();%0A
-
     for(fina
@@ -1270,24 +1270,56 @@
 values()) %7B%0A
+      injector.inject(handler);%0A
       handle

fix failing unit test