use of net.java.truevfs.access.TFileWriter in project mage by magefree.
the class ZipFilesReadWriteTest method test_write.
@Test
public void test_write() {
try {
String zipPath = tempFolder.newFolder().getAbsolutePath();
TFile fileWriteZip = new TFile(Paths.get(zipPath, "temp-images.zip", "DIR", "test.txt").toString());
Assert.assertFalse(fileWriteZip.exists());
Writer writer = new TFileWriter(fileWriteZip);
try {
writer.write("test text");
writer.close();
Assert.assertTrue(fileWriteZip.exists());
TFileReader reader = new TFileReader(fileWriteZip);
BufferedReader br = new BufferedReader(reader);
Assert.assertEquals(br.readLine(), "test text");
reader.close();
} finally {
TVFS.umount();
}
} catch (IOException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}
Aggregations