1 package org.hanseltest; 2 3 import java.io.PrintWriter ; 4 import java.io.StringWriter ; 5 6 import junit.framework.Test; 7 import junit.framework.TestCase; 8 import junit.framework.TestFailure; 9 import junit.framework.TestResult; 10 11 import org.hansel.CoverageDecorator; 12 13 19 public class TestBug747017 extends TestCase { 20 23 public void testBug() { 24 Test test = BugTest.suite(); 25 TestResult result = new TestResult(); 26 test.run(result); 27 28 assertEquals(1, result.failureCount()); 29 30 TestFailure failure = (TestFailure) result.failures().nextElement(); 31 32 StringWriter sw = new StringWriter (); 33 failure.thrownException().printStackTrace(new PrintWriter (sw)); 34 35 assertEquals(sw.toString().indexOf("$BugExample.java"), -1); 36 } 37 38 public static class BugTest extends TestCase { 39 public static Test suite() { 40 return new CoverageDecorator(BugTest.class, 41 new Class [] {BugExample.class}); 42 } 43 44 45 public void testSomething() { 46 } 47 } 48 49 50 public static class BugExample { 51 public BugExample(String someString) { 52 } 53 } 54 } 55 | Popular Tags |