* Test that with only ID3v2 tags, we get the full
* set of information out.
*/
public void testMp3ParsingID3v2() throws Exception {
Parser parser = new AutoDetectParser(); // Should auto-detect!
ContentHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata();
InputStream stream = Mp3ParserTest.class.getResourceAsStream(
"/test-documents/testMP3id3v2.mp3");
try {
parser.parse(stream, handler, metadata);
} finally {
stream.close();
}
assertEquals("audio/mpeg", metadata.get(Metadata.CONTENT_TYPE));
assertEquals("Test Title", metadata.get(Metadata.TITLE));
assertEquals("Test Artist", metadata.get(Metadata.AUTHOR));
String content = handler.toString();
assertTrue(content.contains("Test Title"));
assertTrue(content.contains("Test Artist"));
assertTrue(content.contains("Test Album"));
assertTrue(content.contains("2008"));
assertTrue(content.contains("Test Comment"));