* improved OpenSubtitlesHasherTest

* removed JUnit 3 test suit stubs
This commit is contained in:
Reinhard Pointner 2008-12-21 17:47:35 +00:00
parent 036cf30d3e
commit 7d7913bc1e
7 changed files with 42 additions and 36 deletions

View File

@ -1,5 +1,3 @@
import junit.framework.JUnit4TestAdapter;
import junit.framework.Test;
import net.sourceforge.filebot.FileBotTestSuite;
import net.sourceforge.tuned.TunedTestSuite;
@ -12,8 +10,4 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses( { FileBotTestSuite.class, TunedTestSuite.class })
public class AllTests {
public static Test suite() {
return new JUnit4TestAdapter(AllTests.class);
}
}

View File

@ -2,8 +2,6 @@
package net.sourceforge.filebot;
import junit.framework.JUnit4TestAdapter;
import junit.framework.Test;
import net.sourceforge.filebot.ui.panel.rename.MatcherTestSuite;
import net.sourceforge.filebot.web.WebTestSuite;
@ -16,8 +14,4 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses( { MatcherTestSuite.class, WebTestSuite.class, ArgumentBeanTest.class })
public class FileBotTestSuite {
public static Test suite() {
return new JUnit4TestAdapter(FileBotTestSuite.class);
}
}

View File

@ -2,8 +2,6 @@
package net.sourceforge.filebot.ui.panel.rename;
import junit.framework.JUnit4TestAdapter;
import junit.framework.Test;
import net.sourceforge.filebot.ui.panel.rename.metric.AbstractNameSimilarityMetricTest;
import net.sourceforge.filebot.ui.panel.rename.metric.NumericSimilarityMetricTest;
@ -16,8 +14,4 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses( { AbstractNameSimilarityMetricTest.class, NumericSimilarityMetricTest.class })
public class MatcherTestSuite {
public static Test suite() {
return new JUnit4TestAdapter(MatcherTestSuite.class);
}
}

View File

@ -5,14 +5,52 @@ package net.sourceforge.filebot.web;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.FileInputStream;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
@Ignore("No test data")
public class OpenSubtitlesHasherTest {
@Test
public void computeHash() throws Exception {
assertEquals("8e245d9679d31e12", OpenSubtitlesHasher.computeHash(new File("breakdance.avi")));
private String expectedHash;
private File file;
public OpenSubtitlesHasherTest(String expectedHash, File file) {
this.file = file;
this.expectedHash = expectedHash;
}
@Parameters
public static Collection<Object[]> parameters() {
Object[][] parameters = new Object[3][];
parameters[0] = new Object[] { "8e245d9679d31e12", new File("breakdance.avi") };
parameters[1] = new Object[] { "61f7751fc2a72bfb", new File("dummy.bin") };
parameters[2] = new Object[] { "a79fa10ba3b31395", new File("mini.txt") };
return Arrays.asList(parameters);
}
@Test
public void computeHashFile() throws Exception {
assertEquals(expectedHash, OpenSubtitlesHasher.computeHash(file));
}
@Test
public void computeHashStream() throws Exception {
assertEquals(expectedHash, OpenSubtitlesHasher.computeHash(new FileInputStream(file), file.length()));
}
}

View File

@ -59,7 +59,7 @@ public class SubsceneSubtitleClientTest {
assertEquals("Firefly - The Complete Series", result.getName());
assertEquals("http://subscene.com/Firefly-The-Complete-Series/subtitles-20008.aspx", result.getURL().toString());
assertEquals(15, result.getSubtitleCount());
assertEquals(16, result.getSubtitleCount());
}

View File

@ -2,9 +2,6 @@
package net.sourceforge.filebot.web;
import junit.framework.JUnit4TestAdapter;
import junit.framework.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@ -14,8 +11,4 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses( { TVDotComClientTest.class, AnidbClientTest.class, TVRageClientTest.class, SubsceneSubtitleClientTest.class, OpenSubtitlesHasherTest.class })
public class WebTestSuite {
public static Test suite() {
return new JUnit4TestAdapter(WebTestSuite.class);
}
}

View File

@ -2,9 +2,6 @@
package net.sourceforge.tuned;
import junit.framework.JUnit4TestAdapter;
import junit.framework.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@ -14,8 +11,4 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses( { ByteBufferOutputStreamTest.class, PreferencesMapTest.class, PreferencesListTest.class })
public class TunedTestSuite {
public static Test suite() {
return new JUnit4TestAdapter(TunedTestSuite.class);
}
}