Examples of InitializationError


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

Examples of org.junit.internal.runners.InitializationError

  // 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

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

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

Examples of org.junit.runners.model.InitializationError

                }
                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

Examples of org.junit.runners.model.InitializationError

        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

Examples of org.junit.runners.model.InitializationError

        }

        // 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

Examples of org.junit.runners.model.InitializationError

        }
        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

Examples of org.junit.runners.model.InitializationError

        super(testClass);

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

Examples of org.junit.runners.model.InitializationError

    }
   
    try {
      computeTests();
    } catch (Exception e) {
      throw new InitializationError(e);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.