1 18 19 package org.codehaus.groovy.runtime; 20 21 import junit.framework.Test; 22 import junit.framework.TestResult; 23 24 29 public class ScriptTestAdapter implements Test { 30 private Class scriptClass; 31 private String [] arguments; 32 33 public ScriptTestAdapter(Class scriptClass, String [] arguments) { 34 this.scriptClass = scriptClass; 35 this.arguments = arguments; 36 } 37 38 public int countTestCases() { 39 return 1; 40 } 41 42 public void run(TestResult result) { 43 try { 44 result.startTest(this); 45 46 InvokerHelper.runScript(scriptClass, arguments); 48 result.endTest(this); 49 } 50 catch (Exception e) { 51 result.addError(this, e); 52 } 53 } 54 55 public String toString() { 56 return "TestCase for script: " + scriptClass.getName(); 57 } 58 } 59 | Popular Tags |