Package org.junit.runners.model

Examples of org.junit.runners.model.InitializationError


            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


      // Collect all test candidates, regardless if they will be executed or not.
      suiteDescription = Description.createSuiteDescription(suiteClass);
      testCandidates = collectTestCandidates(suiteDescription);
      testGroups = collectGroups(testCandidates);
    } catch (Throwable t) {
      throw new InitializationError(t);
    }
  }
View Full Code Here

      // Collect all test candidates, regardless if they will be executed or not.
      suiteDescription = Description.createSuiteDescription(suiteClass);
      testCandidates = collectTestCandidates(suiteDescription);
      testGroups = collectGroups(testCandidates);
    } catch (Throwable t) {
      throw new InitializationError(t);
    }
  }
View Full Code Here

  }

  private String getGrammarFileName(Class<?> testClass) throws InitializationError {
    ForGrammar forGrammar = testClass.getAnnotation( ForGrammar.class );
    if ( forGrammar == null ) {
      throw new InitializationError( "A grammar test file must be specified via @" + ForGrammar.class.getSimpleName() + "." );
    }

    return forGrammar.value();
  }
View Full Code Here

    testClass.newInstance();

    spec = Spec.specs.get();

    if (spec == null) {
      throw new InitializationError("test does not contain specification");
    }
    if (spec.behaviours.isEmpty()) {
      throw new InitializationError("no behaviours defined");
    }

    Spec.specs.set(null);
  }
View Full Code Here

        RunnerProvider provider = new RunnerProvider() {
            public boolean isJUnit45OrHigherAvailable() {
                return false;
            }
            public RunnerImpl newInstance(String runnerClassName, Class<?> constructorParam) throws Exception {
                throw new InitializationError("Where is JUnit, dude?");
            }
        };
        RunnerFactory factory = new RunnerFactory(provider);
       
        try {
View Full Code Here

        registerOptOuts(pair.getValue1());

        try {
            GraphManager.set(pair.getValue0().newInstance());
        } catch (Exception ex) {
            throw new InitializationError(ex);
        }
    }
View Full Code Here

    }

    private void validateOptInToSuite(final Class<? extends Graph> klass) throws InitializationError {
        final Graph.OptIn[] optIns = klass.getAnnotationsByType(Graph.OptIn.class);
        if (!gremlinFlavorSuite && !Arrays.stream(optIns).anyMatch(optIn -> optIn.value().equals(this.getClass().getCanonicalName())))
            throw new InitializationError("The suite will not run for this Graph until it is publicly acknowledged with the @OptIn annotation on the Graph instance itself");
    }
View Full Code Here

        final Graph.OptOut[] optOuts = klass.getAnnotationsByType(Graph.OptOut.class);

        if (optOuts != null && optOuts.length > 0) {
            // validate annotation - test class and reason must be set
            if (!Arrays.stream(optOuts).allMatch(ignore -> ignore.test() != null && ignore.reason() != null && !ignore.reason().isEmpty()))
                throw new InitializationError("Check @IgnoreTest annotations - all must have a 'test' and 'reason' set");

            try {
                filter(new OptOutTestFilter(optOuts));
            } catch (NoTestsRemainException ex) {
                throw new InitializationError(ex);
            }
        }
    }
View Full Code Here

    }

    public static Pair<Class<? extends GraphProvider>,Class<? extends Graph>> getGraphProviderClass(final Class<?> klass) throws InitializationError {
        final GraphProviderClass annotation = klass.getAnnotation(GraphProviderClass.class);
        if (null == annotation)
            throw new InitializationError(String.format("class '%s' must have a GraphProviderClass annotation", klass.getName()));
        return Pair.with(annotation.provider(), annotation.graph());
    }
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.