1 package test.dataprovider; 2 3 import org.testng.Assert; 4 import org.testng.TestListenerAdapter; 5 import org.testng.TestNG; 6 import org.testng.annotations.Test; 7 8 public class TestNG411Test { 9 10 @Test verify()11 public void verify() { 12 TestNG tng = new TestNG(); 13 tng.setVerbose(0); 14 tng.setTestClasses(new Class[] { TestNG411SampleTest.class }); 15 TestListenerAdapter al = new TestListenerAdapter(); 16 tng.addListener(al); 17 tng.run(); 18 19 Assert.assertEquals(al.getPassedTests().size(), 1); 20 Assert.assertEquals(al.getPassedTests().get(0).getMethod().getMethodName(), "checkMinTest_injection"); 21 22 Assert.assertEquals(al.getFailedTests().size(), 2); 23 } 24 } 25