/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package java.awt;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import junit.framework.TestCase;

public class EventDispatchThreadRTest extends TestCase {
    
    /**
     * Regression test for JIRA issue HARMONY-2818
     */
    public final void testHARMONY2818() throws Throwable {
        EventQueue.invokeLater(
            new Runnable() {
                public void run() {
                    throw new RuntimeException("expected from EDT"); //$NON-NLS-1$
                }
            }
        );
        EventQueue.invokeAndWait(
            new Runnable() {
                public void run() {
                }
            }
        );
    }
    
    public void testHarmony2116() throws InterruptedException {
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        final PrintStream err = System.err;
        final Toolkit tk;

        System.setErr(new PrintStream(out));
        tk = new ToolkitImpl() {
            protected EventQueue getSystemEventQueueImpl() {
                return null;
            }
        };

        Thread.sleep(100);
        tk.dispatchThread.shutdown();
        tk.dispatchThread.join(3000);
        System.setErr(err);
        assertEquals(0, out.size());
    }
}
@@ -1487,19 +1487,57 @@
     %7D%0A  
+%0A// FIXME: Test deemed to be invalid
   %0A
+//
     publ
@@ -1592,16 +1592,18 @@
 ption %7B%0A
+//
         
@@ -1661,24 +1661,26 @@
 utStream();%0A
+//
         fina
@@ -1711,16 +1711,18 @@
 em.err;%0A
+//
         
@@ -1739,17 +1739,21 @@
 kit tk;%0A
-%0A
+//%0A//
         
@@ -1785,24 +1785,26 @@
 ream(out));%0A
+//
         tk =
@@ -1816,32 +1816,34 @@
 ToolkitImpl() %7B%0A
+//
             prot
@@ -1883,24 +1883,26 @@
 eueImpl() %7B%0A
+//
             
@@ -1918,16 +1918,18 @@
 n null;%0A
+//
         
@@ -1926,32 +1926,34 @@
 //            %7D%0A
+//
         %7D;%0A%0A    
@@ -1947,17 +1947,21 @@
      %7D;%0A
-%0A
+//%0A//
         
@@ -1975,24 +1975,26 @@
 sleep(100);%0A
+//
         tk.d
@@ -2019,16 +2019,18 @@
 down();%0A
+//
         
@@ -2059,16 +2059,18 @@
 (3000);%0A
+//
         
@@ -2089,16 +2089,18 @@
 r(err);%0A
+//
         
@@ -2128,15 +2128,17 @@
 ize());%0A
+//
     %7D%0A%7D

Disable AWT test testHarmony2116 deemed to be invalid.