@@ -0,0 +1,1396 @@
+package ninja;%0A%0Aimport com.google.inject.Inject;%0Aimport com.google.inject.Injector;%0Aimport ninja.utils.NinjaTestServer;%0Aimport org.junit.runners.BlockJUnit4ClassRunner;%0Aimport org.junit.runners.model.InitializationError;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport java.lang.reflect.Field;%0A%0Apublic class NinjaRunner extends BlockJUnit4ClassRunner %7B%0A%0A  private Logger logger = LoggerFactory.getLogger(getClass());%0A%0A  private Injector injector = null;%0A%0A  public NinjaRunner(Class%3C?%3E klass) throws InitializationError %7B%0A    super(klass);%0A    NinjaTestServer ninjaTestServer = new NinjaTestServer();%0A    injector = ninjaTestServer.getInjector();%0A  %7D%0A%0A  @Override%0A  protected Object createTest() throws Exception %7B%0A    Object testObj = super.createTest();%0A%0A    for (Field field : testObj.getClass().getDeclaredFields()) %7B%0A      if (field.isAnnotationPresent(Inject.class)) %7B%0A        Object value = injector.getInstance(field.getType());%0A        logger.debug(%22try to inject %7B%7D to %7B%7D%22, value, testObj);%0A        try %7B%0A          if (field.isAccessible()) %7B%0A            field.set(testObj, value);%0A          %7D%0A          else %7B%0A            field.setAccessible(true);%0A            field.set(testObj, value);%0A            field.setAccessible(false);%0A          %7D%0A        %7D catch (IllegalAccessException e) %7B%0A          e.printStackTrace();%0A        %7D%0A      %7D%0A    %7D%0A%0A    return testObj;%0A  %7D%0A%0A%7D%0A%0A

NinjaRunner , to test service objects : @RunWith(NinjaRunner.class) public class DataServiceTest {