1 18 package org.apache.batik.test; 19 20 27 public class DefaultTestReport implements TestReport { 28 private boolean passed = true; 29 30 protected Entry[] description = null; 31 32 protected Test test; 33 34 private String errorCode; 35 36 40 protected TestSuiteReport parent; 41 42 public DefaultTestReport(Test test){ 43 if(test == null){ 44 throw new IllegalArgumentException (); 45 } 46 47 this.test = test; 48 } 49 50 public TestSuiteReport getParentReport(){ 51 return parent; 52 } 53 54 public void setParentReport(TestSuiteReport parent){ 55 this.parent = parent; 56 } 57 58 public Test getTest(){ 59 return test; 60 } 61 62 public String getErrorCode(){ 63 return errorCode; 64 } 65 66 public void setErrorCode(String errorCode){ 67 if( !passed && errorCode == null ){ 68 71 throw new IllegalArgumentException (); 72 } 73 74 this.errorCode = errorCode; 75 } 76 77 public boolean hasPassed(){ 78 return passed; 79 } 80 81 public void setPassed(boolean passed){ 82 if( !passed && (errorCode == null) ){ 83 86 throw new IllegalArgumentException (); 87 } 88 this.passed = passed; 89 } 90 91 public Entry[] getDescription(){ 92 return description; 93 } 94 95 public void setDescription(Entry[] description){ 96 this.description = description; 97 } 98 99 public void addDescriptionEntry(String key, 100 Object value){ 101 addDescriptionEntry(new Entry(key, value)); 102 } 103 104 protected void addDescriptionEntry(Entry entry){ 105 if(description == null){ 106 description = new Entry[1]; 107 description[0] = entry; 108 } 109 else{ 110 Entry[] oldDescription = description; 111 description = new Entry[description.length + 1]; 112 System.arraycopy(oldDescription, 0, description, 0, 113 oldDescription.length); 114 description[oldDescription.length] = entry; 115 } 116 } 117 118 } 119 120 | Popular Tags |