Siba/test/org/dclermonte/siba/model/SibaManagerTest.java

59 lines
1.3 KiB
Java

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.SibaNullException;
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 = SibaNullException.class)
public void backupTest01() throws ArchiveException, IOException, SibaNullException
{
SibaManager.backup(null, null);
}
/**
*
* @throws ArchiveException
* @throws IOException
* @throws SibaNullException
*/
@Test
public void backupTest02() throws ArchiveException, IOException, SibaNullException
{
String md5LineSource = "qslfjqmlsfjmqlsjfqmlsjfsjf mqlsfjmljdf";
File target = SibaManager.backup(new File("../data/simplestuff"), new File("/home/papou/tmp"));
System.out.println(target.getName());
// Load md5 file.
String encoding = null;
String md5LineTarget = FileUtils.readFileToString(target, encoding);
// Test.
Assert.assertEquals(md5LineSource, md5LineTarget);
}
}