1 29 package net.sourceforge.groboutils.pmti.v1.autodoc.v1; 30 31 32 import net.sourceforge.groboutils.autodoc.v1.testserver.TestDataFactory; 33 import net.sourceforge.groboutils.autodoc.v1.testserver.DefaultTestData; 34 import net.sourceforge.groboutils.autodoc.v1.testserver.TestInfo; 35 36 import junit.framework.AssertionFailedError; 37 38 import java.util.Vector ; 39 40 49 public class ITFTestData extends DefaultTestData 50 { 51 private Vector issueIDs = new Vector (); 52 private Vector errors = new Vector (); 53 private Vector failures = new Vector (); 54 private int testCount = 0; 55 private long startTime = -1; 56 private long endTime = -1; 57 58 59 public ITFTestData( TestInfo info ) 60 { 61 super( info ); 62 } 63 64 65 72 public void addIssueID( String id ) 73 { 74 if (id != null && !this.issueIDs.contains( id )) 75 { 76 this.issueIDs.addElement( id ); 77 } 78 } 79 80 81 84 public void addError( Throwable error ) 85 { 86 if (error != null) 87 { 88 this.errors.addElement( error ); 89 } 90 } 91 92 93 96 public void addFailure( AssertionFailedError failure ) 97 { 98 if (failure != null) 99 { 100 this.failures.addElement( failure ); 101 } 102 } 103 104 105 108 public void addTest() 109 { 110 ++this.testCount; 111 } 112 113 114 117 public void setStartTime( long startTime ) 118 { 119 this.startTime = startTime; 120 } 121 122 123 126 public void setEndTime( long endTime ) 127 { 128 this.endTime = endTime; 129 } 130 131 132 136 public String [] getIssues() 137 { 138 String [] issues = new String [ this.issueIDs.size() ]; 139 this.issueIDs.copyInto( issues ); 140 return issues; 141 } 142 143 144 147 public Throwable [] getErrors() 148 { 149 Throwable t[] = new Throwable [ this.errors.size() ]; 150 this.errors.copyInto( t ); 151 return t; 152 } 153 154 155 158 public AssertionFailedError[] getFailures() 159 { 160 AssertionFailedError s[] = new AssertionFailedError[ 161 this.failures.size() ]; 162 this.failures.copyInto( s ); 163 return s; 164 } 165 166 167 170 public int getSuccessCount() 171 { 172 int c = this.testCount - this.errors.size() - this.failures.size(); 173 if (c < 0) 174 { 175 c = 0; 176 } 177 return c; 178 } 179 180 181 184 public int getTestCount() 185 { 186 return this.testCount; 187 } 188 189 190 193 public long getRunTime() 194 { 195 if (this.startTime < 0 || this.endTime < 0) 196 { 197 return -1L; 198 } 199 return this.endTime - this.startTime; 200 } 201 } 202 203 | Popular Tags |