public void testAudioFileFormat() {
AudioFormat af = new AudioFormat(AudioFormat.Encoding.ALAW, 1f, 2, 3,
4, 5f, true);
AudioFileFormat aff = new MyAudioFileFormat(AudioFileFormat.Type.AIFC,
AudioSystem.NOT_SPECIFIED, af, 100);
assertEquals(AudioFileFormat.Type.AIFC, aff.getType());
assertEquals(AudioSystem.NOT_SPECIFIED, aff.getByteLength());
assertEquals(af, aff.getFormat());
assertEquals(100, aff.getFrameLength());
assertNull(aff.properties());
assertNull(aff.getProperty("key"));
aff = new AudioFileFormat(AudioFileFormat.Type.WAVE, af, 10);
assertEquals(AudioFileFormat.Type.WAVE, aff.getType());
assertEquals(AudioSystem.NOT_SPECIFIED, aff.getByteLength());
assertEquals(af, aff.getFormat());
assertEquals(10, aff.getFrameLength());
assertNull(aff.properties());
assertNull(aff.getProperty("key"));
HashMap<String, Object> prop = new HashMap<String, Object>();
prop.put("duration", Long.valueOf(100));
prop.put("title", "Title String");
aff = new AudioFileFormat(AudioFileFormat.Type.AU, af,
AudioSystem.NOT_SPECIFIED, prop);
assertEquals(AudioFileFormat.Type.AU, aff.getType());
assertEquals(AudioSystem.NOT_SPECIFIED, aff.getByteLength());
assertEquals(af, aff.getFormat());
assertEquals(AudioSystem.NOT_SPECIFIED, aff.getFrameLength());
assertEquals(2, aff.properties().size());
assertEquals(Long.valueOf(100), aff.properties().get("duration"));
assertNull(aff.getProperty("key"));
assertEquals("Title String", aff.getProperty("title"));
try {
aff.properties().put("aa", 1);
fail("No expected UnsupportedOperationException");
} catch (UnsupportedOperationException expected) {
}
}