blob: 8a6973ab606cefddf251705bde4b76993e0331a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package org.junit.tests.running.classes;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
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;
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());
}
}
|