1 package org.hanseltest; 2 3 import junit.framework.Test; 4 import junit.framework.TestCase; 5 6 import org.hansel.CoverageDecorator; 7 8 14 public class TestBug621269 extends TestCase { 15 16 20 public static Test suite() { 21 return new CoverageDecorator(TestBug621269.class, 22 new Class [] { CoverMe.class }); 23 } 24 25 26 public void testBug() { 27 CoverMe cm = new CoverMe(); 28 29 assertEquals(-1, cm.cover(0)); 30 assertEquals(5, cm.cover(1)); 31 } 32 33 37 public static class CoverMe { 38 39 43 public int cover(int i) { 44 synchronized (this) { 45 try { 46 return 5 / i; 47 } catch (ArithmeticException e) { 48 return -1; 49 } 50 } 51 } 52 } 53 } 54 | Popular Tags |