Package org.junit.runners.model

Examples of org.junit.runners.model.InitializationError


    super(klass, builder);
    try {
      filter(new CategoryFilter(getIncludedCategory(klass),
          getExcludedCategory(klass)));
    } catch (NoTestsRemainException e) {
      throw new InitializationError(e);
    }
    assertNoCategorizedDescendentsOfUncategorizeableParents(getDescription());
  }
View Full Code Here


  }
 
  private void assertNoDescendantsHaveCategoryAnnotations(Description description) throws InitializationError {     
    for (Description each : description.getChildren()) {
      if (each.getAnnotation(Category.class) != null)
        throw new InitializationError("Category annotations on Parameterized classes are not supported on individual methods.");
      assertNoDescendantsHaveCategoryAnnotations(each);
    }
  }
View Full Code Here

                return setSchedulers( suiteSuites.wrappingSuite, suiteClasses.wrappingSuite );
            }
            catch ( TestSetFailedException e )
            {
                throw new InitializationError( e );
            }
        }
View Full Code Here

        Module[] modules = new Module[classes.length];
        for (int i = 0; i < classes.length; i++) {
            try {
                modules[i] = (Module) (classes[i]).newInstance();
            } catch (InstantiationException e) {
                throw new InitializationError(e);
            } catch (IllegalAccessException e) {
                throw new InitializationError(e);
            }
        }
        return Guice.createInjector(modules);
    }
View Full Code Here

    }

    private Class<?>[] getModulesFor(Class<?> klass) throws InitializationError {
        GuiceInjectors annotation = klass.getAnnotation(GuiceInjectors.class);
        if (annotation == null) {
            throw new InitializationError(
                    "Missing @GuiceModules annotation for unit test '" + klass.getName()
                    + "'");
        }
        return annotation.value();
    }
View Full Code Here

            final String gripe = "Test class should have at least one @Module method";
            errors.add(new Exception(gripe));
        }

        if (!errors.isEmpty()) {
            throw new InitializationError(errors);
        }
    }
View Full Code Here

        }
        catch ( Exception e )
        {
            final List<Throwable> throwables = new LinkedList<Throwable>();
            throwables.add( e );
            throw new InitializationError( throwables );
        }
    }
View Full Code Here

  }

  private static Class<?> startServerAndIsolateClass(Class<?> klass) throws InitializationError {
    DevAppServerTest testAnno = klass.getAnnotation(DevAppServerTest.class);
    if (testAnno == null) {
      throw new InitializationError(String.format(
          "Test uses %s but is not also annotated with %s.",
          DevAppServerTestRunner.class.getSimpleName(), DevAppServerTest.class.getSimpleName()));
    }
    try {
      DevAppServerTestConfig config = testAnno.value().newInstance();
      DevAppServer devServer = DevAppServerTestHelper.startServer(config);
      return devServer.getAppContext().getClassLoader().loadClass(klass.getName());
    } catch (InstantiationException e) {
      throw new InitializationError(e);
    } catch (IllegalAccessException e) {
      throw new InitializationError(e);
    } catch (ClassNotFoundException e) {
      throw new InitializationError(e);
    }
  }
View Full Code Here

      ClassLoader junitClassLoader = getClass().getClassLoader();
      for (Map.Entry<Class<?>, List<?>> entry : copy.entrySet()) {
        annotationMap.put(junitClassLoader.loadClass(entry.getKey().getName()), entry.getValue());
      }
    } catch (NoSuchFieldException e) {
      throw new InitializationError(e);
    } catch (IllegalAccessException e) {
      throw new InitializationError(e);
    } catch (ClassNotFoundException e) {
      throw new InitializationError(e);
    }
  }
View Full Code Here

    protected static class SuiteWithStringInName extends Suite
    {
      private static Class<?>[] getAnnotatedClasses(Class<?> klass) throws InitializationError {
        SuiteClasses annotation= klass.getAnnotation(SuiteClasses.class);
        if (annotation == null)
          throw new InitializationError(String.format("class '%s' must have a SuiteClasses annotation", klass.getName()));
        return annotation.value();
      }
View Full Code Here

TOP

Related Classes of org.junit.runners.model.InitializationError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.