Package org.junit.runners.model

Examples of org.junit.runners.model.TestClass


public class RuleFieldValidatorTest {
  private final List<Throwable> errors = new ArrayList<Throwable>();
 
  @Test
  public void rejectProtectedClassRule() {
    TestClass target= new TestClass(TestWithProtectedClassRule.class);
    CLASS_RULE_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @ClassRule 'temporaryFolder' must be public.");
  }
View Full Code Here


    protected static TestRule temporaryFolder = new TemporaryFolder();
  }

  @Test
  public void rejectNonStaticClassRule() {
    TestClass target= new TestClass(TestWithNonStaticClassRule.class);
    CLASS_RULE_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @ClassRule 'temporaryFolder' must be static.");
  }
View Full Code Here

    public TestRule temporaryFolder = new TemporaryFolder();
  }

  @Test
  public void acceptNonStaticTestRule() {
    TestClass target= new TestClass(TestWithNonStaticTestRule.class);
    RULE_VALIDATOR.validate(target, errors);
    assertNumberOfErrors(0);
  }
View Full Code Here

    public TestRule temporaryFolder = new TemporaryFolder();
  }

  @Test
  public void acceptMethodRule() throws Exception {
    TestClass target= new TestClass(TestWithMethodRule.class);
    RULE_VALIDATOR.validate(target, errors);
    assertNumberOfErrors(0);
  }
View Full Code Here

      }};
  }

  @Test
  public void rejectArbitraryObjectWithRuleAnnotation() throws Exception {
    TestClass target= new TestClass(TestWithArbitraryObjectWithRuleAnnotation.class);
    RULE_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @Rule 'arbitraryObject' must implement MethodRule or TestRule.");
  }
View Full Code Here

  }

  private List<PotentialAssignment> potentialValues(Method method)
      throws Exception {
    return Assignments.allUnassigned(method,
        new TestClass(HasDateMethod.class))
        .potentialsForNextUnassigned();
  }
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

    }

  }

  private List<FrameworkMethod> uiThreadMethods() {
    return new TestClass(testObject.getClass()).getAnnotatedMethods(UIThread.class);
  }
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<MethodRule> rules = testClass.getAnnotatedFieldValues(
          test, Rule.class, MethodRule.class);
      for (final MethodRule rule : rules) {
        final Field[] ruleFields = rule.getClass().getDeclaredFields();
        for (final Field ruleField : ruleFields) {
          if (ruleField.getAnnotation(annotationType) != null) {
View Full Code Here

    private final TestClass testClass;
    private ServiceManagerProxy serviceManager = null;

    public ApplicationComposer(Class<?> klass) throws InitializationError {
        super(klass);
        testClass = new TestClass(klass);
        validate();
    }
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.