private static String createSuiteDescription(TestSuite ts) { int count = ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
private static String createSuiteDescription(TestSuite ts) { int count = ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
private static Description makeDescription(Test test) { if (test instanceof TestCase) { TestCase tc = (TestCase) test; return Description.createTestDescription(tc.getClass(), tc.getName(), getAnnotations(tc)); } else if (test instanceof TestSuite) { TestSuite ts = (TestSuite) test; String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName(); Description description = Description.createSuiteDescription(name); int n = ts.testCount(); for (int i = 0; i < n; i++) { Description made = makeDescription(ts.testAt(i)); description.addChild(made); } return description; } else if (test instanceof Describable) { Describable adapter = (Describable) test; return adapter.getDescription(); } else if (test instanceof TestDecorator) { TestDecorator decorator = (TestDecorator) test; return makeDescription(decorator.getTest()); } else { // This is the best we can do in this case return Description.createSuiteDescription(test.getClass()); } }
public void filter(Filter filter) throws NoTestsRemainException { if (getTest() instanceof Filterable) { Filterable adapter = (Filterable) getTest(); adapter.filter(filter); } else if (getTest() instanceof TestSuite) { TestSuite suite = (TestSuite) getTest(); TestSuite filtered = new TestSuite(suite.getName()); int n = suite.testCount(); for (int i = 0; i < n; i++) { Test test = suite.testAt(i); if (filter.shouldRun(makeDescription(test))) { filtered.addTest(test); } } setTest(filtered); } }
private static Description makeDescription(Test test) { if (test instanceof TestCase) { TestCase tc = (TestCase) test; return Description.createTestDescription(tc.getClass(), tc.getName()); } else if (test instanceof TestSuite) { TestSuite ts = (TestSuite) test; String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName(); Description description = Description.createSuiteDescription(name); int n = ts.testCount(); for (int i = 0; i < n; i++) { Description made = makeDescription(ts.testAt(i)); description.addChild(made); } return description; } else if (test instanceof Describable) { Describable adapter = (Describable) test; return adapter.getDescription(); } else if (test instanceof TestDecorator) { TestDecorator decorator = (TestDecorator) test; return makeDescription(decorator.getTest()); } else { // This is the best we can do in this case return Description.createSuiteDescription(test.getClass()); } }
public void filter(Filter filter) throws NoTestsRemainException { if (getTest() instanceof Filterable) { Filterable adapter = (Filterable) getTest(); adapter.filter(filter); } else if (getTest() instanceof TestSuite) { TestSuite suite = (TestSuite) getTest(); TestSuite filtered = new TestSuite(suite.getName()); int n = suite.testCount(); for (int i = 0; i < n; i++) { Test test = suite.testAt(i); if (filter.shouldRun(makeDescription(test))) { filtered.addTest(test); } } setTest(filtered); if (filtered.testCount() == 0) { throw new NoTestsRemainException(); } } }
private static String createSuiteDescription(TestSuite ts) { int count = ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
public void filter(Filter filter) throws NoTestsRemainException { if (getTest() instanceof Filterable) { Filterable adapter = (Filterable) getTest(); adapter.filter(filter); } else if (getTest() instanceof TestSuite) { TestSuite suite = (TestSuite) getTest(); TestSuite filtered = new TestSuite(suite.getName()); int n = suite.testCount(); for (int i = 0; i < n; i++) { Test test = suite.testAt(i); if (filter.shouldRun(makeDescription(test))) { filtered.addTest(test); } } setTest(filtered); } }
private static Description makeDescription(Test test) { if (test instanceof TestCase) { TestCase tc = (TestCase) test; return Description.createTestDescription(tc.getClass(), tc.getName()); } else if (test instanceof TestSuite) { TestSuite ts = (TestSuite) test; String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName(); Description description = Description.createSuiteDescription(name); int n = ts.testCount(); for (int i = 0; i < n; i++) { Description made = makeDescription(ts.testAt(i)); description.addChild(made); } return description; } else if (test instanceof Describable) { Describable adapter = (Describable) test; return adapter.getDescription(); } else if (test instanceof TestDecorator) { TestDecorator decorator = (TestDecorator) test; return makeDescription(decorator.getTest()); } else { // This is the best we can do in this case return Description.createSuiteDescription(test.getClass()); } }
/** * Gets the test at the given index */ public Object getChild(Object parent, int index) { TestSuite suite= isTestSuite(parent); if (suite != null) return suite.testAt(index); return null; } /**
private static String createSuiteDescription(TestSuite ts) { int count= ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
private static String createSuiteDescription(TestSuite ts) { int count = ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
private static String createSuiteDescription(TestSuite ts) { int count = ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
private static String createSuiteDescription(TestSuite ts) { int count = ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
private static String createSuiteDescription(TestSuite ts) { int count = ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
private static String createSuiteDescription(TestSuite ts) { int count = ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
private static String createSuiteDescription(TestSuite ts) { int count= ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
@Override public final Test testAt(int index) { maybeCreateTestClassWrappers(); return super.testAt(index); }
private static String createSuiteDescription(TestSuite ts) { int count = ts.countTestCases(); String example = count == 0 ? "" : String.format(" [example: %s]", ts.testAt(0)); return String.format("TestSuite with %s tests%s", count, example); }
public void filter(Filter filter) throws NoTestsRemainException { TestSuite filtered = new TestSuite(testSuite.getName()); int n = testSuite.testCount(); for (int i = 0; i < n; i++) { junit.framework.Test test = testSuite.testAt(i); if (filter.shouldRun(makeDescription(test))) { filtered.addTest(test); } } testSuite = filtered; }