KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.ArrayList JavaDoc;
7 import java.util.Iterator JavaDoc;
8 import java.util.List JavaDoc;
9
10 public class TestFailureSet {
11   private final List JavaDoc list = new ArrayList JavaDoc();
12
13   public void put(TestFailure f) {
14     synchronized (list) {
15       list.add(f);
16     }
17   }
18
19   public String JavaDoc toString() {
20     StringBuffer JavaDoc buf = new StringBuffer JavaDoc("Test failures...\n");
21     synchronized (list) {
22       for (Iterator JavaDoc i = list.iterator(); i.hasNext();) {
23         TestFailure f = (TestFailure) i.next();
24         buf.append(f + "\n");
25       }
26     }
27     return buf.toString();
28   }
29
30   public int size() {
31     synchronized (list) {
32       return list.size();
33     }
34   }
35 }
Popular Tags