01: package test.thread;
02:
03: import java.util.HashMap;
04: import java.util.Map;
05:
06: /**
07: * @testng.test sequential = "true"
08: *
09: * Created on Aug 14, 2006
10: * @author <a href="mailto:cedric@beust.com">Cedric Beust</a>
11: */
12: public class SequentialSampleTest {
13:
14: static Map m_threads = null;
15:
16: /**
17: * @testng.before-class
18: */
19: public void setUp() {
20: m_threads = new HashMap();
21: }
22:
23: /**
24: * @testng.test
25: */
26: public void f1() {
27: Long id = new Long(Thread.currentThread().hashCode());
28: ppp("ID:" + id);
29: m_threads.put(id, id);
30: }
31:
32: /**
33: * @testng.test
34: */
35: public void f2() {
36: Long id = new Long(Thread.currentThread().hashCode());
37: ppp("ID:" + id);
38: m_threads.put(id, id);
39: }
40:
41: /**
42: * @testng.test
43: */
44: public void f3() {
45: Long id = new Long(Thread.currentThread().hashCode());
46: ppp("ID:" + id);
47: m_threads.put(id, id);
48: }
49:
50: private static void ppp(String s) {
51: if (false) {
52: System.out.println("[SequentialSampleTest] " + s);
53: }
54: }
55:
56: }
|