1package test;
2
3import org.testng.Assert;
4import org.testng.ITestResult;
5import org.testng.TestListenerAdapter;
6import org.testng.TestNG;
7import org.testng.annotations.Test;
8import org.testng.collections.Sets;
9
10import java.util.HashSet;
11import java.util.List;
12import java.util.Set;
13
14public class NestedStaticTest extends SimpleBaseTest {
15
16  @Test
17  public void nestedClassShouldBeIncluded() {
18    TestNG tng = create(NestedStaticSampleTest.class);
19    TestListenerAdapter tla = new TestListenerAdapter();
20    tng.addListener(tla);
21    tng.run();
22
23    Set<String> expected = new HashSet<String>() {{
24      add("nested");
25      add("f");
26    }};
27    Set<String> actual = Sets.newHashSet();
28    List<ITestResult> passedTests = tla.getPassedTests();
29    for (ITestResult t : passedTests) {
30      actual.add(t.getMethod().getMethodName());
31    }
32
33    Assert.assertEquals(actual, expected);
34  }
35}
36