AddInstrument.java revision 8729:0242fce0f717
1193323Sed/*
2193323Sed * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
3193323Sed * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4193323Sed *
5193323Sed * This code is free software; you can redistribute it and/or modify it
6193323Sed * under the terms of the GNU General Public License version 2 only, as
7193323Sed * published by the Free Software Foundation.
8193323Sed *
9193323Sed * This code is distributed in the hope that it will be useful, but WITHOUT
10193323Sed * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11193323Sed * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12193323Sed * version 2 for more details (a copy is included in the LICENSE file that
13193323Sed * accompanied this code).
14193323Sed *
15193323Sed * You should have received a copy of the GNU General Public License version
16193323Sed * 2 along with this work; if not, write to the Free Software Foundation,
17193323Sed * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18193323Sed *
19193323Sed * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20193323Sed * or visit www.oracle.com if you need additional information or have any
21193323Sed * questions.
22193323Sed */
23193323Sed
24234353Sdim/* @test
25234353Sdim   @summary Test SimpleSoundbank addInstrument method */
26193323Sed
27193323Sedimport javax.sound.midi.Patch;
28193323Sedimport javax.sound.sampled.*;
29193323Sed
30193323Sedimport com.sun.media.sound.*;
31193323Sed
32193323Sedpublic class AddInstrument {
33193323Sed
34193323Sed    private static void assertEquals(Object a, Object b) throws Exception
35263508Sdim    {
36263508Sdim        if(!a.equals(b))
37263508Sdim            throw new RuntimeException("assertEquals fails!");
38193323Sed    }
39193323Sed
40193323Sed    public static void main(String[] args) throws Exception {
41193323Sed        SimpleSoundbank soundbank = new SimpleSoundbank();
42193323Sed        SimpleInstrument ins = new SimpleInstrument();
43249423Sdim        ins.setPatch(new Patch(3,7));
44249423Sdim        soundbank.addInstrument(ins);
45249423Sdim        assertEquals(soundbank.getInstruments().length, 1);
46249423Sdim        assertEquals(soundbank.getInstruments()[0], ins);
47249423Sdim
48249423Sdim    }
49249423Sdim}
50193323Sed