1 54 55 package junitx.extensions; 56 57 import junit.extensions.TestDecorator; 58 import junit.framework.Protectable; 59 import junit.framework.Test; 60 import junit.framework.TestResult; 61 62 70 public class TestSetup 71 extends TestDecorator { 72 73 public TestSetup(Test test) { 74 super(test); 75 } 76 77 80 public void run(final TestResult result) { 81 Protectable p = new Protectable() { 82 public void protect() throws Exception { 83 try { 84 setUp(); 85 basicRun(result); 86 } finally { 87 tearDown(); 88 } 89 } 90 }; 91 result.runProtected(this, p); 92 } 93 94 98 protected void setUp() 99 throws Exception { 100 } 101 102 106 protected void tearDown() 107 throws Exception { 108 } 109 110 } 111 | Popular Tags |