1 package test.inheritance.testng234; 2 3 import org.testng.Assert; 4 import org.testng.TestListenerAdapter; 5 import org.testng.TestNG; 6 import org.testng.annotations.Test; 7 8 import test.SimpleBaseTest; 9 10 import java.util.Arrays; 11 12 public class PolymorphicFailureTest extends SimpleBaseTest { 13 14 @Test superclassFailureShouldCauseFailure()15 public void superclassFailureShouldCauseFailure() { 16 TestNG tng = create(ChildTest.class); 17 TestListenerAdapter tla = new TestListenerAdapter(); 18 tng.addListener(tla); 19 tng.run(); 20 21 assertTestResultsEqual(tla.getSkippedTests(), Arrays.asList( 22 "polymorphicMethod", 23 "executePolymorphicMethod") 24 ); 25 Assert.assertEquals(0, tla.getPassedTests().size()); 26 Assert.assertEquals(0, tla.getFailedTests().size()); 27 } 28 } 29