KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > test > TestFailure


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.test;
5
6 import org.apache.commons.lang.exception.ExceptionUtils;
7
8 import java.util.Date JavaDoc;
9
10
11 public class TestFailure {
12   private final long timestamp;
13   private final String JavaDoc message;
14   private final Thread JavaDoc thread;
15   private final Throwable JavaDoc throwable;
16   
17   public TestFailure(String JavaDoc message, Thread JavaDoc thread, Throwable JavaDoc throwable) {
18     this.timestamp = System.currentTimeMillis();
19     this.message = message;
20     this.thread = thread;
21     this.throwable= throwable;
22   }
23   
24   public String JavaDoc toString() {
25     StringBuffer JavaDoc buf = new StringBuffer JavaDoc( new Date JavaDoc(timestamp) + " " + thread + message );
26     if (this.throwable != null) {
27       buf.append(": " + ExceptionUtils.getFullStackTrace(this.throwable));
28     }
29     return buf.toString();
30   }
31 }
Popular Tags