1
package org.jaudiotagger.tag.id3;
3
import org.jaudiotagger.AbstractTestCase;
4
import org.jaudiotagger.audio.mp3.MP3File;
9
* testing of reading compressed frames
11
public class FileClosingTest extends AbstractTestCase
14
* This tests checks files are closed after reading attempt
16
public void testClosingFileAfterFailedRead()
18
Exception exception = null;
19
File testFile = AbstractTestCase.copyAudioToTmp("corrupt.mp3");
24
MP3File mp3File = new MP3File(testFile);
31
//Error Should have occured
32
assertTrue(exception != null);
34
//Should be able to delete
35
boolean deleted = testFile.delete();
40
* This tests checks files are closed after succesful reading attempt
42
public void testClosingFileAfterSuccessfulRead()
44
Exception exception = null;
45
File testFile = AbstractTestCase.copyAudioToTmp("testV1.mp3");
50
MP3File mp3File = new MP3File(testFile);
57
//No Error Should have occured
58
assertTrue(exception == null);
60
//Should be able to delete
61
boolean deleted = testFile.delete();
66
* This tests checks files are closed after failed reading attempt (read only)
68
public void testClosingFileAfterFailedReadOnly()
70
Exception exception = null;
71
File testFile = AbstractTestCase.copyAudioToTmp("testV1.mp3");
73
boolean readonly = testFile.setReadOnly();
79
MP3File mp3File = new MP3File(testFile);
86
//Error Should have occured
87
assertTrue(exception != null);
89
//Should be able to delete
90
boolean deleted = testFile.delete();