1 package org.hanseltest; 2 3 import junit.framework.TestCase; 4 import junit.framework.TestResult; 5 6 import org.hansel.CoverageDecorator; 7 import org.hansel.probes.StringProbeFilter; 8 9 14 public class TestProbeFilter extends TestCase { 15 16 private static final Class [] COVERED = {CoverProbeFilter.class}; 17 18 21 public void testNoFilter() { 22 CoverageDecorator cd = new CoverageDecorator(Coverage.class, 23 COVERED); 24 25 TestResult result = new TestResult(); 26 27 cd.run(result); 28 29 assertEquals(1, result.failureCount()); 31 32 assertEquals(0, result.errorCount()); 34 } 35 36 40 public void testFilter() { 41 CoverageDecorator cd = new CoverageDecorator(Coverage.class, 42 COVERED, 43 new StringProbeFilter("filterThis()")); 44 45 TestResult result = new TestResult(); 46 47 cd.run(result); 48 49 assertEquals(0, result.failureCount()); 50 51 assertEquals(0, result.errorCount()); 53 } 54 55 56 57 public static class Coverage extends TestCase { 58 61 public void testClass() { 62 new CoverProbeFilter(); 63 } 64 } 65 66 } 67 | Popular Tags |