1 package org.apidesign.deadlock.logs;
3 import java.util.logging.Handler;
4 import java.util.logging.Level;
5 import java.util.logging.LogRecord;
6 import java.util.logging.Logger;
7 import org.junit.After;
8 import org.junit.AfterClass;
9 import org.junit.Before;
10 import org.junit.BeforeClass;
11 import org.junit.Test;
12 import org.netbeans.junit.NbTestCase;
13 import static org.junit.Assert.*;
15 public class ParallelControlFlowTest extends NbTestCase {
16 public ParallelControlFlowTest(String testName) {
21 protected Level logLevel() {
25 // BEGIN: test.parallel.test.controlflow
26 public void testMain() throws Exception {
27 org.netbeans.junit.Log.controlFlow(Logger.global, null,
28 "THREAD: 1st MSG: cnt: 0" +
29 "THREAD: 2nd MSG: .*0" +
30 "THREAD: 1st MSG: ...: 1" +
31 "THREAD: 2nd MSG: cnt: 1" +
32 "THREAD: 1st MSG: cnt: 2" +
33 "THREAD: 2nd MSG: cnt: 2" +
34 "THREAD: 1st MSG: cnt: 3" +
35 "THREAD: 2nd MSG: cnt: 3" +
36 "THREAD: 1st MSG: cnt: 4" +
37 "THREAD: 2nd MSG: cnt: 4" +
38 "THREAD: 1st MSG: cnt: 5" +
39 "THREAD: 2nd MSG: cnt: 5" +
40 "THREAD: 1st MSG: cnt: 6" +
41 "THREAD: 2nd MSG: cnt: 6" +
42 "THREAD: 1st MSG: cnt: 7" +
43 "THREAD: 2nd MSG: cnt: 7" +
44 "THREAD: 1st MSG: cnt: 8" +
45 "THREAD: 2nd MSG: cnt: 8" +
46 "THREAD: 1st MSG: cnt: 9" +
47 "THREAD: 2nd MSG: cnt: 9",
51 fail("Ok, just print the logged output");
53 // END: test.parallel.test.controlflow
56 // BEGIN: test.parallel.test.fivetwo
57 public void testFiveAndThenTwo() throws Exception {
58 org.netbeans.junit.Log.controlFlow(Logger.global, null,
59 "THREAD: 1st MSG: cnt: 5" +
60 "THREAD: 2nd MSG: cnt: 2" +
61 "THREAD: 1st MSG: cnt: 6",
65 fail("Ok, just print the logged output");
67 // END: test.parallel.test.fivetwo