01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package java.awt;
18:
19: import java.io.ByteArrayOutputStream;
20: import java.io.PrintStream;
21:
22: import junit.framework.TestCase;
23:
24: public class EventDispatchThreadRTest extends TestCase {
25:
26: /**
27: * Regression test for JIRA issue HARMONY-2818
28: */
29: public final void testHARMONY2818() throws Throwable {
30: EventQueue.invokeLater(new Runnable() {
31: public void run() {
32: throw new RuntimeException("expected from EDT"); //$NON-NLS-1$
33: }
34: });
35: EventQueue.invokeAndWait(new Runnable() {
36: public void run() {
37: }
38: });
39: }
40:
41: // FIXME: Test deemed to be invalid
42: // public void testHarmony2116() throws InterruptedException {
43: // final ByteArrayOutputStream out = new ByteArrayOutputStream();
44: // final PrintStream err = System.err;
45: // final Toolkit tk;
46: //
47: // System.setErr(new PrintStream(out));
48: // tk = new ToolkitImpl() {
49: // protected EventQueue getSystemEventQueueImpl() {
50: // return null;
51: // }
52: // };
53: //
54: // Thread.sleep(100);
55: // tk.dispatchThread.shutdown();
56: // tk.dispatchThread.join(3000);
57: // System.setErr(err);
58: // assertEquals(0, out.size());
59: // }
60: }
|