< prev index next >
test/javax/sound/midi/Synthesizer/bug4685396.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -21,19 +21,19 @@
* questions.
*/
import javax.sound.midi.Instrument;
import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Soundbank;
import javax.sound.midi.Synthesizer;
/**
* @test
* @bug 4685396
* @summary Tests that Synthesizer.remapInstrument works
* @run main bug4685396
- * @key headful
*/
public class bug4685396 {
static Synthesizer synth = null;
@@ -47,12 +47,11 @@
static boolean test(
boolean reloadInstr, // reload all instruments?
boolean unloadFrom, // unload "from" instrument?
boolean unloadTo // unload "to" instrument?
- ) throws Exception
- {
+ ) throws MidiUnavailableException {
log("Starting test: reloadInstr=" + reloadInstr
+ ", unloadFrom=" + unloadFrom
+ ", unloadTo=" + unloadTo
+ "");
@@ -162,18 +161,21 @@
)
{
boolean success = false;
try {
success = test(reloadInstr, unloadFrom, unloadTo);
+ } catch (final MidiUnavailableException ignored) {
+ // the test is not applicable
+ success = true;
} catch (Exception ex) {
log("Exception: " + ex.toString());
}
cleanup();
return success;
}
- public static void main(String args[]) throws Exception {
+ public static void main(String args[]) {
boolean failed = false;
if (!runTest(true, false, false))
failed = true;
if (!runTest(true, false, true))
failed = true;
< prev index next >