package org.dclermonte.siba.model; import java.io.File; import java.io.IOException; import org.apache.commons.compress.archivers.ArchiveException; import org.apache.commons.io.FileUtils; import org.dclermonte.siba.SibaException; import org.testng.Assert; import org.testng.annotations.Test; /** * * @author cpm */ public class SibaManagerTest { /** * */ @Test public void aFooTest() { Assert.assertTrue(true); } /** * * @throws IOException * @throws ArchiveException * @throws SibaNullException */ @Test(expectedExceptions = SibaException.class) public void backupTest01() throws ArchiveException, IOException, SibaException { SibaManager.backup(null, null); } /** * * @throws ArchiveException * @throws IOException * @throws SibaNullException */ @Test public void backupTest02() throws ArchiveException, IOException, SibaException { File source = new File("test/org/dclermonte/siba/data/simplestuff"); File target = SibaManager.backup(source, new File("test/org/dclermonte/siba/data/result")); System.out.println(target.getName()); // Load md5 file. String encoding = null; String md5LineTarget = FileUtils.readFileToString(target, encoding); File reference = new File("test/org/dclermonte/siba/data/reference/simplestuff-2016-05-18T22h57mn57s.tgz"); String md5LineSource = FileUtils.readFileToString(reference, encoding); // Test. Assert.assertEquals(md5LineSource, md5LineTarget); } }