Package org.junit.runners.model

Examples of org.junit.runners.model.TestClass


        .getChildren().size(), is(1));
  }

  @Test
  public void theoryAnnotationsAreRetained() throws Exception {
    assertThat(new TestClass(HasATheory.class).getAnnotatedMethods(
        Theory.class).size(), is(1));
  }
View Full Code Here


  /**
   * Constructs a new {@code ParentRunner} that will run {@code @TestClass}
   * @throws InitializationError
   */
  protected ParentRunner(Class<?> testClass) throws InitializationError {
    fTestClass= new TestClass(testClass);
    validate();
  }
View Full Code Here

  /**
   * Constructs a new {@code ParentRunner} that will run {@code @TestClass}
   * @throws InitializationError
   */
  protected ParentRunner(Class<?> testClass) throws InitializationError {
    fTestClass= new TestClass(testClass);
    validate();
  }
View Full Code Here

  /**
   * Constructs a new {@code ParentRunner} that will run {@code @TestClass}
   * @throws InitializationError
   */
  protected ParentRunner(Class<?> testClass) throws InitializationError {
    fTestClass= new TestClass(testClass);
    validate();
  }
View Full Code Here

        return prototypeList;
    }

    private static List<FrameworkMethod> getPrototypesMethods(Class<?> testClass) throws Exception {
        List<FrameworkMethod> methods = new TestClass(testClass).getAnnotatedMethods(Prototypes.class);

        if (methods.isEmpty()) {
            throw new Exception("No public static prototypes method on class " + testClass.getName());
        }
View Full Code Here

     *
     * @throws InitializationError
     */
    private void validateTestClass() throws InitializationError
    {
        TestClass test = getTestClass();
        List<Throwable> errors= new ArrayList<Throwable>();
        if (!FileTest.class.isAssignableFrom(test.getJavaClass())) {
            errors.add(new Exception("The test class " + test.getName() + " should implement FileTest"));
        }
        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

   *
   * @param statement statement
   * @return wrapped statement
   */
  protected Statement withBeforeProcess(Statement statement) {
    TestClass testClass = getTestClass();
    List<FrameworkMethod> befores = testClass.getAnnotatedMethods(BeforeProcess.class);
    befores.addAll(testClass.getAnnotatedMethods(BeforeClass.class));
    return befores.isEmpty() ? statement : new RunBefores(statement, befores, null);
  }
View Full Code Here

   *
   * @param statement statement
   * @return wrapped statement
   */
  protected Statement withAfterProcess(Statement statement) {
    TestClass testClass = getTestClass();
    List<FrameworkMethod> afters = testClass.getAnnotatedMethods(AfterProcess.class);
    afters.addAll(testClass.getAnnotatedMethods(AfterClass.class));
    return afters.isEmpty() ? statement : new RunAfters(statement, afters, null);
  }
View Full Code Here

         @Override
         public void evaluate() throws Throwable
         {
            try
            {
               TestClass testClass = Arquillian.this.getTestClass();
               TestRunnerAdaptor testRunnerAdaptor = deployableTest.get();
               testRunnerAdaptor.beforeClass(testClass.getJavaClass());
               statementWithBefores.evaluate();
            }
            catch (Exception e) // catch and rethrow only to be able to set a break point.
            {
               throw e;
View Full Code Here

     *             If there was an error creating the test object.
     */
    @Override
    protected Object createTest() throws Exception {
      final Object test = super.createTest();
      final TestClass testClass = getTestClass();
      final String browser = seleniumFactory.getBrowser();

      List<FrameworkField> fields = testClass
          .getAnnotatedFields(annotationType);
      for (final FrameworkField field : fields) {
        FieldUtils.writeField(field.getField(), test, selenium, true);
      }

      fields = testClass.getAnnotatedFields(SeleniumBrowser.class);
      for (final FrameworkField field : fields) {
        FieldUtils.writeField(field.getField(), test, browser, true);
      }

      final List<TestRule> rules =this.getTestRules(test);
View Full Code Here

TOP

Related Classes of org.junit.runners.model.TestClass

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.