Package org.junit.tests

Source Code of org.junit.tests.EnclosedTest$Enclosing$A

package org.junit.tests;

import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.JUnitCore;
import org.junit.runner.Request;
import org.junit.runner.Result;
import org.junit.runner.RunWith;
import org.junit.runner.Runner;
import org.junit.runners.Enclosed;

public class EnclosedTest {
  @RunWith(Enclosed.class)
  public static class Enclosing {
    public static class A {
      @Test public void a() {}
      @Test public void b() {}
    }
    public static class B {
      @Test public void a() {}
      @Test public void b() {}
      @Test public void c() {}
    }
  }
 
  @Test public void enclosedRunnerPlansEnclosedClasses() throws Exception {
    Runner runner= Request.aClass(Enclosing.class).getRunner();
    assertEquals(5, runner.testCount());
  }
 
  @Test public void enclosedRunnerRunsEnclosedClasses() throws Exception {
    Result result= JUnitCore.runClasses(Enclosing.class);
    assertEquals(5, result.getRunCount());
  }
 
  @Test public void enclosedRunnerIsNamedForEnclosingClass() throws Exception {
    assertEquals(Enclosing.class.getName(), Request.aClass(Enclosing.class)
        .getRunner().getDescription().getDisplayName());
  }
}
TOP

Related Classes of org.junit.tests.EnclosedTest$Enclosing$A

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.