parent
905cb49d31
commit
419255bf34
BIN
lib/junit.jar
BIN
lib/junit.jar
Binary file not shown.
|
@ -1,4 +1,7 @@
|
|||
|
||||
package net.sourceforge.filebot;
|
||||
|
||||
|
||||
import net.sourceforge.tuned.TunedTestSuite;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue