Package org.junit.runners.model

Examples of org.junit.runners.model.TestClass


  /**
   * Wrap the given statement in any declared MethodRules.
   */
  @SuppressWarnings("deprecation")
  private Statement wrapMethodRules(Statement s, TestCandidate c, Object instance) {
    TestClass info = new TestClass(suiteClass);
    FrameworkMethod fm = new FrameworkMethod(c.method);
    for (org.junit.rules.MethodRule each :
        info.getAnnotatedFieldValues(suiteClass, Rule.class, org.junit.rules.MethodRule.class))
      s = each.apply(s, fm, instance);
    return s;
  }
View Full Code Here


     * By default JUnit includes all methods annotated with @Test. This method only allows methods annotated with @Keys to be included in the list of methods to be run in a
     * TestCase. Any @Test methods will be ignored
     */
    @Override
    protected List<FrameworkMethod> computeTestMethods() {
        final TestClass testClass = getTestClass();
        return testClass.getAnnotatedMethods(MetaTest.class);
    }
View Full Code Here

    return client.getOAuth2ClientContext();
  }

  private void initializeIfNecessary(FrameworkMethod method, final Object target) {

    final TestClass testClass = new TestClass(target.getClass());
    OAuth2ContextConfiguration contextConfiguration = findOAuthContextConfiguration(method, testClass);
    if (contextConfiguration == null) {
      // Nothing to do
      return;
    }

    this.initializeAccessToken = contextConfiguration.initialize();

    this.resource = creatResource(target, contextConfiguration);

    final List<FrameworkMethod> befores = testClass.getAnnotatedMethods(BeforeOAuth2Context.class);
    if (!befores.isEmpty()) {

      logger.debug("Running @BeforeOAuth2Context methods");

      for (FrameworkMethod before : befores) {
View Full Code Here

  /**
   * Wrap the given statement in any declared MethodRules.
   */
  @SuppressWarnings("deprecation")
  private Statement wrapMethodRules(Statement s, TestCandidate c, Object instance) {
    TestClass info = new TestClass(suiteClass);
    FrameworkMethod fm = new FrameworkMethod(c.method);
    for (org.junit.rules.MethodRule each :
        info.getAnnotatedFieldValues(suiteClass, Rule.class, org.junit.rules.MethodRule.class))
      s = each.apply(s, fm, instance);
    return s;
  }
View Full Code Here

    }
  }

  @Test(expected= IllegalArgumentException.class)
  public void complainIfMultipleConstructors() {
    new TestClass(TwoConstructors.class);
  }
View Full Code Here

    public TestRule x;
  }

  @Test
  public void fieldsOnSubclassesShadowSuperclasses() {
    assertThat(new TestClass(SubclassWithField.class).getAnnotatedFields(
        Rule.class).size(), is(1));
  }
View Full Code Here

  }

  @Test
  public void identifyNonStaticInnerClass() {
    assertThat(
        new TestClass(OuterClass.NonStaticInnerClass.class)
            .isANonStaticInnerClass(),
        is(true));
  }
View Full Code Here

  }

  @Test
  public void dontMarkStaticInnerClassAsNonStatic() {
    assertThat(
        new TestClass(OuterClass2.StaticInnerClass.class)
            .isANonStaticInnerClass(),
        is(false));
  }
View Full Code Here

  public static class SimpleClass {
  }

  @Test
  public void dontMarkNonInnerClassAsInnerClass() {
    assertThat(new TestClass(SimpleClass.class).isANonStaticInnerClass(),
        is(false));
  }
View Full Code Here

  @Test
  public void dataPointsAnnotationMeansTreatAsArrayOnly()
      throws SecurityException, NoSuchMethodException {
    List<PotentialAssignment> valueSources= new AllMembersSupplier(
        new TestClass(HasDataPoints.class))
        .getValueSources(ParameterSignature.signatures(
            HasDataPoints.class.getConstructor(Object.class))
            .get(0));
    assertThat(valueSources.size(), is(2));
  }
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.