1 21 22 package org.apache.derbyTesting.unitTests.harness; 23 24 import org.apache.derbyTesting.unitTests.harness.UnitTest; 25 import org.apache.derby.iapi.services.stream.HeaderPrintWriter; 26 27 30 class BasicUnitTest implements UnitTest 31 { 32 String traceMessage; 33 int testType; 34 int testDuration; 35 boolean result; 36 Error exception; 37 38 BasicUnitTest(String traceMessage, 39 int testType, 40 int testDuration, 41 boolean result, 42 Error exception){ 43 this.traceMessage = traceMessage; 44 this.testType = testType; 45 this.testDuration = testDuration; 46 this.result = result; 47 this.exception = exception; 48 } 49 50 public String toString(){ 51 return ("testType: "+testType+" testDuration: "+ 52 testDuration+" traceMessage: "+traceMessage+ 53 " result: "+result+" exception: "+exception); 54 } 55 56 57 public boolean Execute (HeaderPrintWriter output) { 58 59 output.printlnWithHeader(toString()); 60 if (exception != null) 61 throw exception; 62 63 return result; 64 } 65 66 67 68 public int UnitTestDuration(){ 69 return testDuration; 70 } 71 72 public int UnitTestType(){ 73 return testType; 74 } 75 76 private void executeCatch(HeaderPrintWriter output){ 77 try{ 78 Execute(output); 79 } 80 catch (Error e){ 81 System.out.println("Caught exception:"+ e); 82 } 83 } 84 85 116 } 117 118 | Popular Tags |