KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > junit > client > Trial


1 /*
2  * Copyright 2007 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.junit.client;
17
18 import com.google.gwt.junit.client.impl.ExceptionWrapper;
19 import com.google.gwt.user.client.rpc.IsSerializable;
20
21 import java.util.Map JavaDoc;
22 import java.util.HashMap JavaDoc;
23
24 /**
25  * The result of a single trial-run of a single benchmark method. Each Trial
26  * contains the results of running a benchmark method with one set of
27  * values for its parameters. TestResults for a method will contain Trials
28  * for all permutations of the parameter values. For test methods without
29  * parameters, there is only 1 trial result.
30  *
31  * @skip
32  */

33 public class Trial implements IsSerializable {
34
35   ExceptionWrapper exceptionWrapper;
36
37   double runTimeMillis;
38
39   // Deserialized from exceptionWrapper on the server-side
40
transient Throwable JavaDoc exception;
41
42   /**
43    * @gwt.typeArgs <java.lang.String,java.lang.String>
44    */

45   Map JavaDoc/*<String,String>*/ variables;
46
47   /**
48    * Creates a new Trial.
49    *
50    * @param runTimeMillis The amount of time spent executing the test
51    * @param exceptionWrapper The wrapped getException thrown by the the last
52    * test, or <code>null</code> if the last test
53    * completed successfully.
54    */

55   public Trial(Map JavaDoc/*<String,String>*/ variables, double runTimeMillis,
56       ExceptionWrapper exceptionWrapper) {
57     this.variables = variables;
58     this.runTimeMillis = runTimeMillis;
59     this.exceptionWrapper = exceptionWrapper;
60   }
61
62   public Trial() {
63     this.variables = new HashMap JavaDoc();
64   }
65
66   public Throwable JavaDoc getException() {
67     return exception;
68   }
69
70   public ExceptionWrapper getExceptionWrapper() {
71     return exceptionWrapper;
72   }
73
74   public double getRunTimeMillis() {
75     return runTimeMillis;
76   }
77
78   /**
79    * Returns the names and values of the variables used in the test. If there
80    * were no variables, the map is empty.
81    */

82   public Map JavaDoc getVariables() {
83     return variables;
84   }
85
86   public void setException(Throwable JavaDoc exception) {
87     this.exception = exception;
88   }
89
90   public void setExceptionWrapper(ExceptionWrapper exceptionWrapper) {
91     this.exceptionWrapper = exceptionWrapper;
92   }
93
94   public void setRunTimeMillis(double runTimeMillis) {
95     this.runTimeMillis = runTimeMillis;
96   }
97
98   public String JavaDoc toString() {
99     return "variables: " + variables + ", exceptionWrapper: " + exceptionWrapper
100         + ", runTimeMillis: " + runTimeMillis;
101   }
102 }
103
Popular Tags