Close.java revision 8729:0242fce0f717
1195534Sscottl/* 2195534Sscottl * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. 3195534Sscottl * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4195534Sscottl * 5195534Sscottl * This code is free software; you can redistribute it and/or modify it 6195534Sscottl * under the terms of the GNU General Public License version 2 only, as 7195534Sscottl * published by the Free Software Foundation. 8195534Sscottl * 9195534Sscottl * This code is distributed in the hope that it will be useful, but WITHOUT 10195534Sscottl * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11195534Sscottl * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12195534Sscottl * version 2 for more details (a copy is included in the LICENSE file that 13212636Smav * accompanied this code). 14212636Smav * 15212636Smav * You should have received a copy of the GNU General Public License version 16212636Smav * 2 along with this work; if not, write to the Free Software Foundation, 17212636Smav * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18212636Smav * 19212636Smav * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20212636Smav * or visit www.oracle.com if you need additional information or have any 21212636Smav * questions. 22212636Smav */ 23212636Smav 24195534Sscottl/* @test 25195534Sscottl @summary Test SoftSynthesizer close method */ 26195534Sscottl 27237370Smariusimport javax.sound.midi.MidiDevice; 28195534Sscottlimport javax.sound.midi.MidiUnavailableException; 29195534Sscottlimport javax.sound.midi.Patch; 30195534Sscottlimport javax.sound.sampled.*; 31195534Sscottlimport javax.sound.midi.MidiDevice.Info; 32195534Sscottl 33195534Sscottlimport com.sun.media.sound.*; 34195534Sscottl 35195534Sscottlpublic class Close { 36195534Sscottl 37195534Sscottl private static void assertEquals(Object a, Object b) throws Exception 38195534Sscottl { 39195534Sscottl if(!a.equals(b)) 40195534Sscottl throw new RuntimeException("assertEquals fails!"); 41195534Sscottl } 42195534Sscottl 43195534Sscottl private static void assertTrue(boolean value) throws Exception 44195534Sscottl { 45195534Sscottl if(!value) 46195534Sscottl throw new RuntimeException("assertTrue fails!"); 47195534Sscottl } 48195534Sscottl 49195534Sscottl public static void main(String[] args) throws Exception { 50204565Smav AudioSynthesizer synth = new SoftSynthesizer(); 51204565Smav synth.openStream(null, null); 52195534Sscottl synth.close(); 53204565Smav assertTrue(!synth.isOpen()); 54235578Sgjb 55195534Sscottl } 56195534Sscottl} 57195534Sscottl