Package org.junit.runners.model

Examples of org.junit.runners.model.InitializationError


                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

        }

        // override by getter method, if present
        List<FrameworkMethod> getters = getTestClass().getAnnotatedMethods(ArchivePathGetter.class);
        if (getters.size() > 1) {
            throw new InitializationError("Only one method should be annotated with @ArchivePathGetter. "
                + "The test case \"" + getTestClass().getName() + "\" has " + getters.size() + " annotated methods.");
        }
        if (classAnnotation == null && getters.size() == 0) {
            throw new InitializationError("No archive path annotations found. The test case \""
                + getTestClass().getName() + "\" should be annotated with @ArchivePath or @ArchivePathGetter");
        }
        if (getters.size() == 1) {
            path = invokeGetter(getters.get(0).getMethod());
        }

        // validate the path
        if (path == null) {
            throw new InitializationError("Archive path is null.");
        }
        return path;
    }
View Full Code Here

        }
        if (getter.getParameterTypes().length != 0) {
            errors.add(new Exception("The method " + getterName + " should have no parameters."));
        }
        if (errors.size() != 0) {
            throw new InitializationError(errors);
        }
        try {
            Object result = getter.invoke(null);
            if (result instanceof String) {
                return (String) result;
            }
        } catch (Exception exception) {
            throw new InitializationError(exception);
        }
        return null;
    }
View Full Code Here

        super(testClass);

        try {
            listeners = new Listeners(getListeners());
        } catch (Throwable e) {
            throw new InitializationError(e);
        }
    }
View Full Code Here

    }
   
    try {
      computeTests();
    } catch (Exception e) {
      throw new InitializationError(e);
    }
  }
View Full Code Here

                    } else {
                        testObjects.add(testObject);
                    }
                }
      } else {
        throw new InitializationError(
            "Wrong signature for the @PerformanceTestSuite method");
      }
    }

    // Retrieve the methods before running the methods from the test suite
    List<FrameworkMethod> beforeSuiteMethods = getTestClass()
        .getAnnotatedMethods(BeforeSuite.class);
    if (beforeSuiteMethods.size() > 1) {
      throw new InitializationError(
          "Only one @BeforeSuite method is allowed for a @PerformanceSuite");
    }

    // Retrieve the methods before running the methods from the test suite
    List<FrameworkMethod> afterSuiteMethods = getTestClass()
        .getAnnotatedMethods(AfterSuite.class);
    if (afterSuiteMethods.size() > 1) {
      throw new InitializationError(
          "Only one @AfterSuite method is allowed for a @PerformanceSuite");
    }

    PerformanceSuiteState current = null;
    boolean suiteAlreadyRegistered = false;
View Full Code Here

    static public class ExceptionThrowingRunnerFactory implements
            ParametersRunnerFactory {
        public Runner createRunnerForTestWithParameters(TestWithParameters test)
                throws InitializationError {
            throw new InitializationError(
                    "Called ExceptionThrowingRunnerFactory.");
        }
View Full Code Here

            if( !(o instanceof SlingRemoteTestParameters)) {
                throw new IllegalArgumentException(o.getClass().getName()
                        + " is not a " + SlingRemoteTestParameters.class.getSimpleName());
            }
        } catch(Exception e) {
            throw new InitializationError(e);
        }
       
        // Set configured username using "admin" as default credential
        final String configuredUsername = System.getProperty(SlingTestBase.TEST_SERVER_USERNAME);
        if (configuredUsername != null && configuredUsername.trim().length() > 0) {
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.