Package org.junit.runners.model

Examples of org.junit.runners.model.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


  private void validate() throws InitializationError {
    List<Throwable> errors= new ArrayList<Throwable>();
    collectInitializationErrors(errors);
    if (!errors.isEmpty())
      throw new InitializationError(errors);
  }
View Full Code Here

        return runnerClass.getConstructor(Class.class,
            RunnerBuilder.class).newInstance(
            new Object[] { testClass, fSuiteBuilder });
      } catch (NoSuchMethodException e2) {
        String simpleName= runnerClass.getSimpleName();
        throw new InitializationError(String.format(
            CONSTRUCTOR_ERROR_FORMAT, simpleName, simpleName));
      }
    }
  }
View Full Code Here

        super( clazz );

        ProcessorSuite suite = clazz.getAnnotation( ProcessorSuite.class );

        if ( null == suite ) {
            throw new InitializationError( "The test class must be annotated with " + ProcessorSuite.class.getName() );
        }

        if ( suite.processorTypes().length == 0 ) {
            throw new InitializationError( "ProcessorSuite#processorTypes must not be empty" );
        }

        methods = initializeTestCases( suite );
    }
View Full Code Here

    public OpenEjbRunner(final Class<?> testClazz) throws InitializationError {
        this.testClazz = testClazz;
        try {
            delegate = getDelegateRunner(testClazz);
        } catch (final Throwable e) {
            throw new InitializationError(Arrays.asList(e));
        }
    }
View Full Code Here

     * @param builder builds runners for classes in the suite
     */
    @SuppressWarnings("unchecked")
  public JavaSpecRunner(Class<?> klass, RunnerBuilder builder) throws InitializationError {
        if(!JavaSpec.class.isAssignableFrom(klass)){
            throw new InitializationError("Your class["+klass+"] must extend " + JavaSpec.class + " to be run with " +  JavaSpecRunner.class.getSimpleName());
        }
        this.clase = (Class<? extends JavaSpec>) klass;
        createJunitTestTreeFromSpecClass();
    }
View Full Code Here

     * Creates the test tree to be used to describe and execute the tests in junit
     */
    private void createJunitTestTreeFromSpecClass() throws InitializationError {
        SpecTree specTree = SpecParser.create().parse(clase);
        if(specTree.hasNoTests()){
            throw new InitializationError("The spec class["+clase.getSimpleName()+"] has no tests. You must at least use one it() or one xit() inside your definition method");
        }
        junitAdapter = JunitTestTreeAdapter.create(specTree, clase);
    }
View Full Code Here

                Reader reader = new InputStreamReader(archive.getInputStream(entry));
                addTest(list, entry.getName(), reader);
            }
            archive.close();
        } catch (IOException exception) {
            throw new InitializationError(exception);
        }
        return list;
    }
View Full Code Here

                }
                return;
            }
        } catch (Exception exception) {
            // should not happen, since the test class was validated before
            throw new InitializationError(exception);
        }
        throw new InitializationError("Failed to initialize the test for \"" + name + "\"");
    }
View Full Code Here

        if (test.getOnlyConstructor().getParameterTypes().length != 0) {
            errors.add(new Exception("Constructor of " + test.getName() + " should have no parameters"));
        }
        validatePublicVoidNoArgMethods(Test.class, false, errors);
        if (errors.size() != 0) {
            throw new InitializationError(errors);
        }
    }
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.