private void handleInitializationError(
      final boolean developmentMode,
      final List<TestClassResult> result,
      final String klassName,
      final Class<?> klass,
      final InitializationError e) {
    TestClass testClass = new TestClass(klass);

    boolean allMethods =
        (!developmentMode) || (klass.getAnnotation(TestDuringDevelopment.class) != null);

    List<Throwable> causes = e.getCauses();
    long now = System.currentTimeMillis();
    List<TestCaseResult> testCaseResults = new ArrayList<TestCaseResult>();
    List<FrameworkMethod> annotatedMethods = testClass.getAnnotatedMethods(Test.class);

    Exception wrapperException = new Exception("Error during initialization. See log for details");
    wrapperException.setStackTrace(new StackTraceElement[0]);

    for (FrameworkMethod frameworkMethod : annotatedMethods) {
      if (allMethods || (frameworkMethod.getAnnotation(TestDuringDevelopment.class) != null)) {
        TestCaseResult testCaseResult =
            new TestCaseResult(frameworkMethod.getName(), now, now, wrapperException);

        testCaseResults.add(testCaseResult);
      }
    }

    TestClassResult classResult =
        new TestClassResult(klassName, 0, testCaseResults.size(), 0, 0, now, now, testCaseResults);

    result.add(classResult);

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    pw.write("Error during initialization of test class '" + klassName + "':\n");
    for (Throwable throwable : causes) {
      throwable.printStackTrace(pw);
    }
    LOGGER.log(Level.SEVERE, sw.toString());
  }
 /**
  * Clients may override this method to add additional behavior when a {@link InitializationError}
  * is raised. The call of this method is guaranteed.
  *
  * @param notifier the notifier
  * @param e the error
  */
 protected void whenInitializationErrorIsRaised(
     final EachTestNotifier notifier, final InitializationError e) {
   notifier.addFailure(new MultipleFailureException(e.getCauses()));
 }