Close.java revision 829:b06c29386f63
190075Sobrien/* 290075Sobrien * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 3132718Skan * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 490075Sobrien * 590075Sobrien * This code is free software; you can redistribute it and/or modify it 690075Sobrien * under the terms of the GNU General Public License version 2 only, as 790075Sobrien * published by the Free Software Foundation. Sun designates this 890075Sobrien * particular file as subject to the "Classpath" exception as provided 990075Sobrien * by Sun in the LICENSE file that accompanied this code. 1090075Sobrien * 1190075Sobrien * This code is distributed in the hope that it will be useful, but WITHOUT 1290075Sobrien * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1390075Sobrien * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1490075Sobrien * version 2 for more details (a copy is included in the LICENSE file that 1590075Sobrien * accompanied this code). 1690075Sobrien * 1790075Sobrien * You should have received a copy of the GNU General Public License version 1890075Sobrien * 2 along with this work; if not, write to the Free Software Foundation, 1990075Sobrien * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2090075Sobrien * 2190075Sobrien * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2290075Sobrien * CA 95054 USA or visit www.sun.com if you need additional information or 2390075Sobrien * have any questions. 2490075Sobrien */ 2590075Sobrien 2690075Sobrien/* @test 2790075Sobrien @summary Test SoftSynthesizer close method */ 2890075Sobrien 2990075Sobrienimport javax.sound.midi.MidiDevice; 3090075Sobrienimport javax.sound.midi.MidiUnavailableException; 3190075Sobrienimport javax.sound.midi.Patch; 3290075Sobrienimport javax.sound.sampled.*; 3390075Sobrienimport javax.sound.midi.MidiDevice.Info; 3490075Sobrien 3590075Sobrienimport com.sun.media.sound.*; 3690075Sobrien 3790075Sobrienpublic class Close { 3890075Sobrien 3990075Sobrien private static void assertEquals(Object a, Object b) throws Exception 4090075Sobrien { 4190075Sobrien if(!a.equals(b)) 42132718Skan throw new RuntimeException("assertEquals fails!"); 43132718Skan } 4490075Sobrien 4590075Sobrien private static void assertTrue(boolean value) throws Exception 4690075Sobrien { 4790075Sobrien if(!value) 48117395Skan throw new RuntimeException("assertTrue fails!"); 4990075Sobrien } 5090075Sobrien 5190075Sobrien public static void main(String[] args) throws Exception { 52132718Skan AudioSynthesizer synth = new SoftSynthesizer(); 53132718Skan synth.openStream(null, null); 54132718Skan synth.close(); 55132718Skan assertTrue(!synth.isOpen()); 5690075Sobrien 5790075Sobrien } 5890075Sobrien} 5990075Sobrien