Package org.junit.internal.runners

Examples of org.junit.internal.runners.InitializationError


  }

  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


  // add parameters to getRunner(), which would be much more complicated.
  private static Set<Class<?>> parents = new HashSet<Class<?>>();
 
  private static Class<?> addParent(Class<?> parent) throws InitializationError {
    if (!parents.add(parent))
      throw new InitializationError(String.format("class '%s' (possibly indirectly) contains itself as a SuiteClass", parent.getName()));
    return parent;
  }
View Full Code Here

  }

  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

    private final List/*<String>*/ targetsOrder = new LinkedList();
   
    private AntUnitSuiteRunner(AntUnitSuite suite, Class junitTestClass) throws InitializationError {
        junit3Suite = suite;
        if (suite.hasAntInitError()) {
            throw new InitializationError(
                    new Throwable[] { suite.getAntInitialisationException() }
                  );
        } else {
            Enumeration tests = suite.tests();
            while (tests.hasMoreElements()) {
View Full Code Here

    private static AntUnitSuite getJUnit3AntSuite(Class testCaseClass)
            throws InitializationError {
        try {
            Method suiteMethod = testCaseClass.getMethod("suite", new Class[0]);
            if (!Modifier.isStatic(suiteMethod.getModifiers())) {
                throw new InitializationError("suite method must be static");
            }
            Object suite = suiteMethod.invoke(null, new Object[0]);
            if (suite == null) {
                throw new InitializationError("suite method can not return null");
            }
            if (!(suite instanceof AntUnitSuite)) {
                throw new InitializationError("suite method must return an AntUnitSuite");
            }
            return (AntUnitSuite) suite;
        } catch (NoSuchMethodException e) {
            throw new InitializationError(new Throwable[] { e });
        } catch (IllegalAccessException e) {
            throw new InitializationError(new Throwable[] { e });
        } catch (InvocationTargetException e) {
            throw new InitializationError(new Throwable[] { e });
        }
    }
View Full Code Here

                    return field;
                }
            }
        }
       
        throw new InitializationError("no Mockery found in test class "
            + testClass);
    }
View Full Code Here

  // add parameters to getRunner(), which would be much more complicated.
  private static Set<Class<?>> parents = new HashSet<Class<?>>();
 
  private static Class<?> addParent(Class<?> parent) throws InitializationError {
    if (!parents.add(parent))
      throw new InitializationError(String.format("class '%s' (possibly indirectly) contains itself as a SuiteClass", parent.getName()));
    return parent;
  }
View Full Code Here

  }

  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

  public Runner buildRunner(Class<? extends Runner> runnerClass) {
    try {
      return runnerClass.getConstructor(Class.class).newInstance(new Object[] { fTestClass });
    } catch (NoSuchMethodException e) {
      String simpleName= runnerClass.getSimpleName();
      InitializationError error= new InitializationError(String.format(
          CONSTRUCTOR_ERROR_FORMAT, simpleName, simpleName));
      return Request.errorReport(fTestClass, error).getRunner();
    } catch (Exception e) {
      return Request.errorReport(fTestClass, e).getRunner();
    }
View Full Code Here

         fTestClass = testClass;
      }

      public void assertValid() throws InitializationError {
         if (!fErrors.isEmpty())
            throw new InitializationError(fErrors);
      }
View Full Code Here

TOP

Related Classes of org.junit.internal.runners.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.