1 29 package net.sourceforge.groboutils.pmti.v1.itf.impl; 30 31 import net.sourceforge.groboutils.pmti.v1.itf.ITestRecord; 32 33 34 35 42 public class ImmutableTestRecord implements ITestRecord 43 { 44 45 private String name; 46 private String suite; 47 private int tCount; 48 private long tRuntime; 49 private String [] failures; 50 private String [] errors; 51 private String log; 52 53 54 public ImmutableTestRecord( String name, String suite, int tCount, 55 long tRuntime, String [] failures, String [] errors, String log ) 56 { 57 setTestName( name ); 58 setTestSuite( suite ); 59 setTestCount( tCount ); 60 setRuntime( tRuntime ); 61 setFailures( failures ); 62 setErrors( errors ); 63 setLog( log ); 64 } 65 66 67 public ImmutableTestRecord( ITestRecord tr ) 68 { 69 if (tr == null) 70 { 71 throw new IllegalArgumentException ("no null arguments"); 72 } 73 74 setTestName( tr.getTestName() ); 75 setTestSuite( tr.getTestSuite() ); 76 setTestCount( tr.getTestCount() ); 77 setRuntime( tr.getRuntime() ); 78 setFailures( tr.getFailures() ); 79 setErrors( tr.getErrors() ); 80 setLog( tr.getLog() ); 81 } 82 83 84 public String getTestName() 85 { 86 return this.name; 87 } 88 89 public String getTestSuite() 90 { 91 return this.suite; 92 } 93 94 public int getTestCount() 95 { 96 return this.tCount; 97 } 98 99 public long getRuntime() 100 { 101 return this.tRuntime; 102 } 103 104 public String [] getFailures() 105 { 106 String ret[] = new String [ this.failures.length ]; 107 System.arraycopy( this.failures, 0, ret, 0, this.failures.length ); 108 return ret; 109 } 110 111 public String [] getErrors() 112 { 113 String ret[] = new String [ this.errors.length ]; 114 System.arraycopy( this.errors, 0, ret, 0, this.errors.length ); 115 return ret; 116 } 117 118 public String getLog() 119 { 120 return this.log; 121 } 122 123 124 125 128 ImmutableTestRecord() 129 { 130 setErrors( null ); 131 setFailures( null ); 132 } 133 134 135 void setTestName( String name ) 136 { 137 this.name = name; 138 } 139 140 141 void setTestSuite( String suite ) 142 { 143 this.suite = suite; 144 } 145 146 147 void setTestCount( int count ) 148 { 149 if (count < 0) 150 { 151 count = 0; 152 } 153 this.tCount = count; 154 } 155 156 157 void setRuntime( long time ) 158 { 159 if (time < 0L) 160 { 161 time = 0L; 162 } 163 this.tRuntime = time; 164 } 165 166 167 void setFailures( String [] f ) 168 { 169 if (f == null) 170 { 171 f = new String [0]; 172 } 173 this.failures = new String [ f.length ]; 174 System.arraycopy( f, 0, this.failures, 0, f.length ); 175 } 176 177 178 void setErrors( String [] e ) 179 { 180 if (e == null) 181 { 182 e = new String [0]; 183 } 184 this.errors = new String [ e.length ]; 185 System.arraycopy( e, 0, this.errors, 0, e.length ); 186 } 187 188 189 void setLog( String log ) 190 { 191 this.log = log; 192 } 193 } 194 195 | Popular Tags |