1 package org.apidesign.deadlock.logs;
3 import java.util.logging.Level;
4 import java.util.logging.Logger;
5 import org.netbeans.junit.NbTestCase;
6 import static org.junit.Assert.*;
8 public class ParallelControlFlowTest extends NbTestCase {
9 public ParallelControlFlowTest(String testName) {
14 protected Level logLevel() {
18 // BEGIN: test.parallel.test.controlflow
19 public void testMain() throws Exception {
20 org.netbeans.junit.Log.controlFlow(Logger.global, null,
21 "THREAD: 1st MSG: cnt: 0" +
22 "THREAD: 2nd MSG: .*0" +
23 "THREAD: 1st MSG: ...: 1" +
24 "THREAD: 2nd MSG: cnt: 1" +
25 "THREAD: 1st MSG: cnt: 2" +
26 "THREAD: 2nd MSG: cnt: 2" +
27 "THREAD: 1st MSG: cnt: 3" +
28 "THREAD: 2nd MSG: cnt: 3" +
29 "THREAD: 1st MSG: cnt: 4" +
30 "THREAD: 2nd MSG: cnt: 4" +
31 "THREAD: 1st MSG: cnt: 5" +
32 "THREAD: 2nd MSG: cnt: 5" +
33 "THREAD: 1st MSG: cnt: 6" +
34 "THREAD: 2nd MSG: cnt: 6" +
35 "THREAD: 1st MSG: cnt: 7" +
36 "THREAD: 2nd MSG: cnt: 7" +
37 "THREAD: 1st MSG: cnt: 8" +
38 "THREAD: 2nd MSG: cnt: 8" +
39 "THREAD: 1st MSG: cnt: 9" +
40 "THREAD: 2nd MSG: cnt: 9",
44 if (Boolean.getBoolean("no.failures")) return;
45 fail("Ok, just print the logged output");
47 // END: test.parallel.test.controlflow
50 // BEGIN: test.parallel.test.fivetwo
51 public void testFiveAndThenTwo() throws Exception {
52 org.netbeans.junit.Log.controlFlow(Logger.global, null,
53 "THREAD: 1st MSG: cnt: 5" +
54 "THREAD: 2nd MSG: cnt: 2" +
55 "THREAD: 1st MSG: cnt: 6",
59 if (Boolean.getBoolean("no.failures")) return;
60 fail("Ok, just print the logged output");
62 // END: test.parallel.test.fivetwo