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

59 lines
1.3 KiB
Java
Raw Normal View History

package org.dclermonte.siba.model;
2016-05-15 16:56:10 +02:00
import java.io.File;
import java.io.IOException;
import org.apache.commons.compress.archivers.ArchiveException;
2016-05-16 23:40:07 +02:00
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);
}
/**
2016-05-15 16:56:10 +02:00
*
* @throws IOException
* @throws ArchiveException
2016-05-16 23:40:07 +02:00
* @throws SibaNullException
*/
2016-05-16 23:40:07 +02:00
@Test(expectedExceptions = SibaNullException.class)
public void backupTest01() throws ArchiveException, IOException, SibaNullException
{
SibaManager.backup(null, null);
}
2016-05-15 16:56:10 +02:00
/**
*
* @throws ArchiveException
* @throws IOException
2016-05-16 23:40:07 +02:00
* @throws SibaNullException
2016-05-15 16:56:10 +02:00
*/
@Test
2016-05-16 23:40:07 +02:00
public void backupTest02() throws ArchiveException, IOException, SibaNullException
2016-05-15 16:56:10 +02:00
{
String md5LineSource = "qslfjqmlsfjmqlsjfqmlsjfsjf mqlsfjmljdf";
File target = SibaManager.backup(new File("../data/simplestuff"), new File("/home/papou/tmp"));
System.out.println(target.getName());
2016-05-15 16:56:10 +02:00
// Load md5 file.
2016-05-16 23:40:07 +02:00
String encoding = null;
String md5LineTarget = FileUtils.readFileToString(target, encoding);
2016-05-15 16:56:10 +02:00
// Test.
Assert.assertEquals(md5LineSource, md5LineTarget);
}
}