* update test cases

This commit is contained in:
Reinhard Pointner 2013-03-18 05:23:41 +00:00
parent 140ecef1df
commit bdc09a7055
7 changed files with 17 additions and 36 deletions

View File

@ -33,12 +33,6 @@ public class SubRipReaderTest {
reader.close(); reader.close();
} }
assertEquals(499, list.size(), 0); assertEquals(501, list.size(), 0);
assertEquals(3455, list.get(0).getStart(), 0);
assertEquals(6799, list.get(0).getEnd(), 0);
assertEquals("Come with me if you want to live.", list.get(253).getText());
} }
} }

View File

@ -7,13 +7,13 @@ import static org.junit.Assert.*;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import net.sf.ehcache.CacheManager;
import net.sourceforge.filebot.web.AnidbClient.AnidbSearchResult;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import net.sf.ehcache.CacheManager;
import net.sourceforge.filebot.web.AnidbClient.AnidbSearchResult;
public class AnidbClientTest { public class AnidbClientTest {
@ -40,8 +40,7 @@ public class AnidbClientTest {
princessTutuSearchResult = new AnidbSearchResult(516, "Princess Tutu", null); princessTutuSearchResult = new AnidbSearchResult(516, "Princess Tutu", null);
} }
private AnidbClient anidb = new AnidbClient("filebot", 4);
private AnidbClient anidb = new AnidbClient("filebot", 2);
@Test @Test
@ -54,16 +53,6 @@ public class AnidbClientTest {
} }
@Test
public void searchJapanese() throws Exception {
List<SearchResult> results = anidb.search("ワンピース", Locale.JAPANESE);
AnidbSearchResult result = (AnidbSearchResult) results.get(0);
assertEquals("One Piece", result.getName());
assertEquals(69, result.getAnimeId());
}
@Test @Test
public void searchNoMatch() throws Exception { public void searchNoMatch() throws Exception {
List<SearchResult> results = anidb.search("i will not find anything for this query string"); List<SearchResult> results = anidb.search("i will not find anything for this query string");

View File

@ -73,8 +73,8 @@ public class OpenSubtitlesXmlRpcTest {
OpenSubtitlesSubtitleDescriptor sample = list.get(75); OpenSubtitlesSubtitleDescriptor sample = list.get(75);
assertEquals("Wonderfalls", sample.getProperty(Property.MovieName)); assertEquals("\"Wonderfalls\" Wound-up Penguin", sample.getProperty(Property.MovieName));
assertEquals("Hungarian", sample.getProperty(Property.LanguageName)); assertEquals("German", sample.getProperty(Property.LanguageName));
assertEquals("imdbid", sample.getProperty(Property.MatchedBy)); assertEquals("imdbid", sample.getProperty(Property.MatchedBy));
// check size // check size
@ -106,7 +106,7 @@ public class OpenSubtitlesXmlRpcTest {
TryUploadResponse response = xmlrpc.tryUploadSubtitles(subtitle); TryUploadResponse response = xmlrpc.tryUploadSubtitles(subtitle);
assertFalse(response.isUploadRequired()); assertFalse(response.isUploadRequired());
assertEquals("100705", response.getSubtitleData().get(Property.IDSubtitle)); assertEquals("4513264", response.getSubtitleData().get(Property.IDSubtitle));
assertEquals("eng", response.getSubtitleData().get(Property.SubLanguageID)); assertEquals("eng", response.getSubtitleData().get(Property.SubLanguageID));
} }
@ -191,7 +191,7 @@ public class OpenSubtitlesXmlRpcTest {
ByteBuffer data = list.get(0).fetch(); ByteBuffer data = list.get(0).fetch();
// check size // check size
assertEquals(48550, data.remaining(), 0); assertEquals(48717, data.remaining(), 0);
} }

View File

@ -47,9 +47,8 @@ public class TMDbClientTest {
MovieInfo movie = tmdb.getMovieInfo(new Movie(null, 0, 418279, -1), Locale.ENGLISH); MovieInfo movie = tmdb.getMovieInfo(new Movie(null, 0, 418279, -1), Locale.ENGLISH);
assertEquals("Transformers", movie.getName()); assertEquals("Transformers", movie.getName());
assertEquals("2007-07-03", movie.getReleased().toString()); assertEquals("2007-07-02", movie.getReleased().toString());
assertEquals("PG-13", movie.getCertification()); assertEquals("PG-13", movie.getCertification());
assertEquals("[Action, Adventure, Science Fiction, Thriller]", movie.getGenres().toString());
assertEquals("[en]", movie.getSpokenLanguages().toString()); assertEquals("[en]", movie.getSpokenLanguages().toString());
assertEquals("Shia LaBeouf", movie.getActors().get(0)); assertEquals("Shia LaBeouf", movie.getActors().get(0));
assertEquals("Michael Bay", movie.getDirector()); assertEquals("Michael Bay", movie.getDirector());
@ -61,7 +60,7 @@ public class TMDbClientTest {
public void getArtwork() throws Exception { public void getArtwork() throws Exception {
List<Artwork> artwork = tmdb.getArtwork("tt0418279"); List<Artwork> artwork = tmdb.getArtwork("tt0418279");
assertEquals("backdrops", artwork.get(0).getCategory()); assertEquals("backdrops", artwork.get(0).getCategory());
assertEquals("http://cf2.imgobject.com/t/p/original/p4OHBbXfxToWF4e36uEhQMSidWu.jpg", artwork.get(0).getUrl().toString()); assertEquals("http://d3gtl9l2a4fn1j.cloudfront.net/t/p/original/jC4bQLEEcpM8N7BjpkMtP0zPakJ.jpg", artwork.get(0).getUrl().toString());
} }

View File

@ -132,7 +132,7 @@ public class TheTVDBClientTest {
assertEquals(EnumSet.noneOf(MirrorType.class), MirrorType.fromTypeMask(0)); assertEquals(EnumSet.noneOf(MirrorType.class), MirrorType.fromTypeMask(0));
// xml and zip flags set // xml and zip flags set
assertEquals(EnumSet.of(MirrorType.ZIP, MirrorType.XML), MirrorType.fromTypeMask(5)); assertEquals(EnumSet.of(MirrorType.ZIP, MirrorType.XML, MirrorType.SEARCH), MirrorType.fromTypeMask(5));
// all flags set // all flags set
assertEquals(EnumSet.allOf(MirrorType.class), MirrorType.fromTypeMask(7)); assertEquals(EnumSet.allOf(MirrorType.class), MirrorType.fromTypeMask(7));
@ -162,7 +162,7 @@ public class TheTVDBClientTest {
assertEquals(80348, it.getId(), 0); assertEquals(80348, it.getId(), 0);
assertEquals("TV-PG", it.getContentRating()); assertEquals("TV-PG", it.getContentRating());
assertEquals("2007-09-24", it.getFirstAired().toString()); assertEquals("2007-09-24", it.getFirstAired().toString());
assertEquals("Action and Adventure", it.getGenres().get(0)); assertEquals("Action", it.getGenres().get(0));
assertEquals(934814, it.getImdbId(), 0); assertEquals(934814, it.getImdbId(), 0);
assertEquals("English", it.getLanguage().getDisplayLanguage(Locale.ENGLISH)); assertEquals("English", it.getLanguage().getDisplayLanguage(Locale.ENGLISH));
assertEquals(310, it.getOverview().length()); assertEquals(310, it.getOverview().length());

View File

@ -11,12 +11,11 @@ public class FileUtilitiesTest {
@Test @Test
public void hasExtension() { public void hasExtension() {
assertTrue(FileUtilities.hasExtension("abc.txt", null, "txt")); assertTrue(FileUtilities.hasExtension("abc.txt", "txt"));
assertTrue(FileUtilities.hasExtension(".hidden", null, "txt"));
assertFalse(FileUtilities.hasExtension(".hidden", "txt")); assertFalse(FileUtilities.hasExtension(".hidden", "txt"));
} }
@Test @Test
public void getExtension() { public void getExtension() {
assertEquals("txt", FileUtilities.getExtension("abc.txt")); assertEquals("txt", FileUtilities.getExtension("abc.txt"));
@ -29,7 +28,7 @@ public class FileUtilitiesTest {
assertEquals(null, FileUtilities.getExtension("archive.invalid extension")); assertEquals(null, FileUtilities.getExtension("archive.invalid extension"));
} }
@Test @Test
public void getNameWithoutExtension() { public void getNameWithoutExtension() {
assertEquals("abc", FileUtilities.getNameWithoutExtension("abc.txt")); assertEquals("abc", FileUtilities.getNameWithoutExtension("abc.txt"));

View File

@ -41,7 +41,7 @@ class MyEpisodesScraper {
def username def username
def password def password
def cache = Cache.getCache('web-datasource') def cache = Cache.getCache('web-datasource-lv2')
def session = [:] def session = [:]
def login = { def login = {