* update to junit 3.6

* update some test cases
This commit is contained in:
Reinhard Pointner 2009-05-16 20:18:17 +00:00
parent 905cb49d31
commit 419255bf34
5 changed files with 38 additions and 53 deletions

Binary file not shown.

View File

@ -1,4 +1,7 @@
package net.sourceforge.filebot;
import net.sourceforge.tuned.TunedTestSuite;
import org.junit.runner.RunWith;

View File

@ -3,7 +3,7 @@ package net.sourceforge.filebot;
import net.sourceforge.filebot.format.ExpressionFormatTest;
import net.sourceforge.filebot.hash.VerificationFileScannerTest;
import net.sourceforge.filebot.hash.VerificationFormatTest;
import net.sourceforge.filebot.similarity.SimilarityTestSuite;
import net.sourceforge.filebot.ui.panel.rename.MatchModelTest;
import net.sourceforge.filebot.web.WebTestSuite;
@ -14,7 +14,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses( { SimilarityTestSuite.class, WebTestSuite.class, ArgumentBeanTest.class, ExpressionFormatTest.class, VerificationFileScannerTest.class, MatchModelTest.class })
@SuiteClasses( { SimilarityTestSuite.class, WebTestSuite.class, ArgumentBeanTest.class, ExpressionFormatTest.class, VerificationFormatTest.class, MatchModelTest.class })
public class FileBotTestSuite {
}

View File

@ -1,51 +0,0 @@
package net.sourceforge.filebot.hash;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.io.File;
import java.util.Scanner;
import java.util.Map.Entry;
import org.junit.Test;
public class VerificationFileScannerTest {
@Test
public void nextLine() {
// trim lines, skip empty lines
String text = String.format("%s %n %n%n%n %s%n%s", "line 1", "line 2", "line 3");
VerificationFileScanner lines = new VerificationFileScanner(new Scanner(text));
assertEquals("line 1", lines.nextLine());
assertEquals("line 2", lines.nextLine());
assertEquals("line 3", lines.nextLine());
assertFalse(lines.hasNext());
}
@Test
public void parseLine() {
VerificationFileScanner reader = new VerificationFileScanner(new Scanner("null"));
// md5
Entry<File, String> md5 = reader.parseLine("50e85fe18e17e3616774637a82968f4c *folder/file.txt");
assertEquals("file.txt", md5.getKey().getName());
assertEquals("folder", md5.getKey().getParent());
assertEquals("50e85fe18e17e3616774637a82968f4c", md5.getValue());
// sha1
Entry<File, String> sha1 = reader.parseLine("1a02a7c1e9ac91346d08829d5037b240f42ded07 ?SHA1*folder/file.txt");
assertEquals("file.txt", sha1.getKey().getName());
assertEquals("folder", sha1.getKey().getParent());
assertEquals("1a02a7c1e9ac91346d08829d5037b240f42ded07", sha1.getValue());
}
}

View File

@ -0,0 +1,33 @@
package net.sourceforge.filebot.hash;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.util.Map.Entry;
import org.junit.Test;
public class VerificationFormatTest {
@Test
public void parseLine() throws Exception {
VerificationFormat format = new VerificationFormat();
// md5
Entry<File, String> md5 = format.parseObject("50e85fe18e17e3616774637a82968f4c *folder/file.txt");
assertEquals("file.txt", md5.getKey().getName());
assertEquals("folder", md5.getKey().getParent());
assertEquals("50e85fe18e17e3616774637a82968f4c", md5.getValue());
// sha1
Entry<File, String> sha1 = format.parseObject("1a02a7c1e9ac91346d08829d5037b240f42ded07 ?SHA1*folder/file.txt");
assertEquals("file.txt", sha1.getKey().getName());
assertEquals("folder", sha1.getKey().getParent());
assertEquals("1a02a7c1e9ac91346d08829d5037b240f42ded07", sha1.getValue());
}
}