some comments
This commit is contained in:
parent
c525aa9ea0
commit
25e5bde57b
|
@ -50,7 +50,6 @@ public abstract class AbstractSearchPanel<S, E, T extends JComponent> extends Fi
|
|||
private final EventList<String> searchHistory = new BasicEventList<String>();
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public AbstractSearchPanel(String title, Icon icon) {
|
||||
super(title, icon);
|
||||
|
||||
|
|
|
@ -97,7 +97,6 @@ public class OpenSubtitlesClient {
|
|||
*
|
||||
* @throws XmlRpcFault
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized void logout() throws XmlRpcFault {
|
||||
try {
|
||||
invoke("LogOut", token);
|
||||
|
|
|
@ -13,19 +13,26 @@ import org.junit.Test;
|
|||
|
||||
public class AnidbClientTest {
|
||||
|
||||
private static HyperLink testResult;
|
||||
private static HyperLink shortLinkTestResult;
|
||||
/**
|
||||
* 74 episodes
|
||||
*/
|
||||
private static HyperLink monsterSearchResult;
|
||||
|
||||
private AnidbClient anidb = new AnidbClient();
|
||||
/**
|
||||
* 45 episodes, direct result page (short_link)
|
||||
*/
|
||||
private static HyperLink twelvekingdomsSearchResult;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
testResult = new HyperLink("Monster", new URL("http://anidb.net/perl-bin/animedb.pl?show=anime&aid=1539"));
|
||||
shortLinkTestResult = new HyperLink("Juuni Kokuki", new URL("http://anidb.net/a26"));
|
||||
monsterSearchResult = new HyperLink("Monster", new URL("http://anidb.net/perl-bin/animedb.pl?show=anime&aid=1539"));
|
||||
twelvekingdomsSearchResult = new HyperLink("Juuni Kokuki", new URL("http://anidb.net/a26"));
|
||||
}
|
||||
|
||||
|
||||
private AnidbClient anidb = new AnidbClient();
|
||||
|
||||
|
||||
@Test
|
||||
public void search() throws Exception {
|
||||
List<SearchResult> results = anidb.search("one piece");
|
||||
|
@ -52,7 +59,7 @@ public class AnidbClientTest {
|
|||
|
||||
@Test
|
||||
public void getEpisodeListAll() throws Exception {
|
||||
List<Episode> list = anidb.getEpisodeList(testResult);
|
||||
List<Episode> list = anidb.getEpisodeList(monsterSearchResult);
|
||||
|
||||
assertEquals(74, list.size());
|
||||
|
||||
|
@ -67,7 +74,7 @@ public class AnidbClientTest {
|
|||
|
||||
@Test
|
||||
public void getEpisodeListAllShortLink() throws Exception {
|
||||
List<Episode> list = anidb.getEpisodeList(shortLinkTestResult);
|
||||
List<Episode> list = anidb.getEpisodeList(twelvekingdomsSearchResult);
|
||||
|
||||
assertEquals(45, list.size());
|
||||
|
||||
|
@ -82,7 +89,7 @@ public class AnidbClientTest {
|
|||
|
||||
@Test
|
||||
public void getEpisodeListLink() throws Exception {
|
||||
assertEquals(testResult.getURL().toString(), anidb.getEpisodeListLink(testResult).toURL().toString());
|
||||
assertEquals(monsterSearchResult.getURL().toString(), anidb.getEpisodeListLink(monsterSearchResult).toURL().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,28 +17,35 @@ import org.junit.Test;
|
|||
|
||||
public class SubsceneSubtitleClientTest {
|
||||
|
||||
private static SubsceneSearchResult testResult;
|
||||
private static SubsceneSearchResult manySubtitlesTestResult;
|
||||
/**
|
||||
* Twin Peaks - First Season, ~ 15 subtitles
|
||||
*/
|
||||
private static SubsceneSearchResult twinpeaksSearchResult;
|
||||
|
||||
private SubsceneSubtitleClient subscene = new SubsceneSubtitleClient();
|
||||
/**
|
||||
* Lost - Fourth Season, ~ 430 subtitles
|
||||
*/
|
||||
private static SubsceneSearchResult lostSearchResult;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
testResult = new SubsceneSearchResult("Twin Peaks - First Season (1990)", new URL("http://subscene.com/twin-peaks--first-season/subtitles-32482.aspx"), 17);
|
||||
manySubtitlesTestResult = new SubsceneSearchResult("Lost - Fourth Season (2008)", new URL("http://subscene.com/Lost-Fourth-Season/subtitles-70963.aspx"), 420);
|
||||
twinpeaksSearchResult = new SubsceneSearchResult("Twin Peaks - First Season (1990)", new URL("http://subscene.com/twin-peaks--first-season/subtitles-32482.aspx"), 17);
|
||||
lostSearchResult = new SubsceneSearchResult("Lost - Fourth Season (2008)", new URL("http://subscene.com/Lost-Fourth-Season/subtitles-70963.aspx"), 420);
|
||||
}
|
||||
|
||||
|
||||
private SubsceneSubtitleClient subscene = new SubsceneSubtitleClient();
|
||||
|
||||
|
||||
@Test
|
||||
public void search() throws Exception {
|
||||
List<SearchResult> results = subscene.search("twin peaks");
|
||||
|
||||
SubsceneSearchResult result = (SubsceneSearchResult) results.get(1);
|
||||
|
||||
assertEquals(testResult.getName(), result.getName());
|
||||
assertEquals(testResult.getURL().toString(), result.getURL().toString());
|
||||
assertEquals(testResult.getSubtitleCount(), result.getSubtitleCount());
|
||||
assertEquals(twinpeaksSearchResult.getName(), result.getName());
|
||||
assertEquals(twinpeaksSearchResult.getURL().toString(), result.getURL().toString());
|
||||
assertEquals(twinpeaksSearchResult.getSubtitleCount(), result.getSubtitleCount());
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,7 +65,7 @@ public class SubsceneSubtitleClientTest {
|
|||
|
||||
@Test
|
||||
public void getSubtitleListSearchResult() throws Exception {
|
||||
List<SubtitleDescriptor> subtitleList = subscene.getSubtitleList(testResult, Locale.ITALIAN);
|
||||
List<SubtitleDescriptor> subtitleList = subscene.getSubtitleList(twinpeaksSearchResult, Locale.ITALIAN);
|
||||
|
||||
assertEquals(1, subtitleList.size());
|
||||
|
||||
|
@ -72,15 +79,16 @@ public class SubsceneSubtitleClientTest {
|
|||
|
||||
@Test
|
||||
public void getSubtitleListSearchResultMany() throws Exception {
|
||||
List<SubtitleDescriptor> subtitleList = subscene.getSubtitleList(manySubtitlesTestResult, LanguageResolver.getDefault().getLocale("Vietnamese"));
|
||||
List<SubtitleDescriptor> subtitleList = subscene.getSubtitleList(lostSearchResult, LanguageResolver.getDefault().getLocale("Vietnamese"));
|
||||
|
||||
// lots of subtitles, but only one is vietnamese
|
||||
assertEquals(1, subtitleList.size());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getSubtitleListLink() throws Exception {
|
||||
assertEquals(testResult.getURL().toString(), subscene.getSubtitleListLink(testResult).toURL().toString());
|
||||
assertEquals(twinpeaksSearchResult.getURL().toString(), subscene.getSubtitleListLink(twinpeaksSearchResult).toURL().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,35 +14,46 @@ import org.junit.Test;
|
|||
|
||||
public class TVDotComClientTest {
|
||||
|
||||
private static HyperLink testResult;
|
||||
private static HyperLink singleSeasonTestResult;
|
||||
private static HyperLink manySeasonsTestResult;
|
||||
/**
|
||||
* 145 episodes / 7 seasons
|
||||
*/
|
||||
private static HyperLink buffySearchResult;
|
||||
|
||||
private TVDotComClient tvdotcom = new TVDotComClient();
|
||||
/**
|
||||
* 13 episodes / 1 season only
|
||||
*/
|
||||
private static HyperLink fireflySearchResult;
|
||||
|
||||
/**
|
||||
* more than 700 episodes / 26 seasons (on going)
|
||||
*/
|
||||
private static HyperLink doctorwhoTestResult;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
testResult = new HyperLink("Buffy the Vampire Slayer", new URL("http://www.tv.com/buffy-the-vampire-slayer/show/10/episode_listings.html"));
|
||||
singleSeasonTestResult = new HyperLink("Firefly", new URL("http://www.tv.com/firefly/show/7097/episode_listings.html"));
|
||||
manySeasonsTestResult = new HyperLink("Doctor Who", new URL("http://www.tv.com/doctor-who/show/355/episode_listings.html"));
|
||||
buffySearchResult = new HyperLink("Buffy the Vampire Slayer", new URL("http://www.tv.com/buffy-the-vampire-slayer/show/10/episode_listings.html"));
|
||||
fireflySearchResult = new HyperLink("Firefly", new URL("http://www.tv.com/firefly/show/7097/episode_listings.html"));
|
||||
doctorwhoTestResult = new HyperLink("Doctor Who", new URL("http://www.tv.com/doctor-who/show/355/episode_listings.html"));
|
||||
}
|
||||
|
||||
|
||||
private TVDotComClient tvdotcom = new TVDotComClient();
|
||||
|
||||
|
||||
@Test
|
||||
public void search() throws Exception {
|
||||
List<SearchResult> results = tvdotcom.search("Buffy");
|
||||
|
||||
HyperLink result = (HyperLink) results.get(0);
|
||||
|
||||
assertEquals(testResult.getName(), result.getName());
|
||||
assertEquals(testResult.getURL().toString(), result.getURL().toString());
|
||||
assertEquals(buffySearchResult.getName(), result.getName());
|
||||
assertEquals(buffySearchResult.getURL().toString(), result.getURL().toString());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeList() throws Exception {
|
||||
List<Episode> results = tvdotcom.getEpisodeList(testResult, 7);
|
||||
List<Episode> results = tvdotcom.getEpisodeList(buffySearchResult, 7);
|
||||
|
||||
assertEquals(22, results.size());
|
||||
|
||||
|
@ -57,7 +68,7 @@ public class TVDotComClientTest {
|
|||
|
||||
@Test
|
||||
public void getEpisodeListAllMultiSeason() throws Exception {
|
||||
List<Episode> list = tvdotcom.getEpisodeList(testResult);
|
||||
List<Episode> list = tvdotcom.getEpisodeList(buffySearchResult);
|
||||
|
||||
assertEquals(145, list.size());
|
||||
|
||||
|
@ -72,7 +83,7 @@ public class TVDotComClientTest {
|
|||
|
||||
@Test
|
||||
public void getEpisodeListAllSingleSeason() throws Exception {
|
||||
List<Episode> list = tvdotcom.getEpisodeList(singleSeasonTestResult);
|
||||
List<Episode> list = tvdotcom.getEpisodeList(fireflySearchResult);
|
||||
|
||||
assertEquals(15, list.size());
|
||||
|
||||
|
@ -87,21 +98,22 @@ public class TVDotComClientTest {
|
|||
|
||||
@Test
|
||||
public void getEpisodeListAllManySeasons() throws Exception {
|
||||
List<Episode> list = tvdotcom.getEpisodeList(manySeasonsTestResult);
|
||||
List<Episode> list = tvdotcom.getEpisodeList(doctorwhoTestResult);
|
||||
|
||||
// there are still new episodes coming out
|
||||
assertTrue(list.size() > 700);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeListLink() {
|
||||
assertEquals(tvdotcom.getEpisodeListLink(testResult, 1).toString(), "http://www.tv.com/buffy-the-vampire-slayer/show/10/episode_listings.html?season=1");
|
||||
assertEquals(tvdotcom.getEpisodeListLink(buffySearchResult, 1).toString(), "http://www.tv.com/buffy-the-vampire-slayer/show/10/episode_listings.html?season=1");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeListLinkAll() {
|
||||
assertEquals(tvdotcom.getEpisodeListLink(testResult, 0).toString(), "http://www.tv.com/buffy-the-vampire-slayer/show/10/episode_listings.html?season=0");
|
||||
assertEquals(tvdotcom.getEpisodeListLink(buffySearchResult, 0).toString(), "http://www.tv.com/buffy-the-vampire-slayer/show/10/episode_listings.html?season=0");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,9 +13,10 @@ import org.junit.Test;
|
|||
|
||||
public class TVRageClientTest {
|
||||
|
||||
private static TVRageSearchResult testResult = new TVRageSearchResult("Buffy the Vampire Slayer", 2930, "http://www.tvrage.com/Buffy_The_Vampire_Slayer");
|
||||
|
||||
private TVRageClient tvrage = new TVRageClient();
|
||||
/**
|
||||
* 145 episodes / 7 seasons
|
||||
*/
|
||||
private static TVRageSearchResult buffySearchResult = new TVRageSearchResult("Buffy the Vampire Slayer", 2930, "http://www.tvrage.com/Buffy_The_Vampire_Slayer");
|
||||
|
||||
|
||||
@Test
|
||||
|
@ -24,15 +25,17 @@ public class TVRageClientTest {
|
|||
|
||||
TVRageSearchResult result = (TVRageSearchResult) results.get(0);
|
||||
|
||||
assertEquals(testResult.getName(), result.getName());
|
||||
assertEquals(testResult.getShowId(), result.getShowId());
|
||||
assertEquals(testResult.getLink(), result.getLink());
|
||||
assertEquals(buffySearchResult.getName(), result.getName());
|
||||
assertEquals(buffySearchResult.getShowId(), result.getShowId());
|
||||
assertEquals(buffySearchResult.getLink(), result.getLink());
|
||||
}
|
||||
|
||||
|
||||
private TVRageClient tvrage = new TVRageClient();
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeList() throws Exception {
|
||||
List<Episode> list = tvrage.getEpisodeList(testResult, 7);
|
||||
List<Episode> list = tvrage.getEpisodeList(buffySearchResult, 7);
|
||||
|
||||
assertEquals(22, list.size());
|
||||
|
||||
|
@ -47,7 +50,7 @@ public class TVRageClientTest {
|
|||
|
||||
@Test
|
||||
public void getEpisodeListAll() throws Exception {
|
||||
List<Episode> list = tvrage.getEpisodeList(testResult);
|
||||
List<Episode> list = tvrage.getEpisodeList(buffySearchResult);
|
||||
|
||||
assertEquals(145, list.size());
|
||||
|
||||
|
@ -62,19 +65,19 @@ public class TVRageClientTest {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void getEpisodeListIllegalSeason() throws Exception {
|
||||
tvrage.getEpisodeList(testResult, 42);
|
||||
tvrage.getEpisodeList(buffySearchResult, 42);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeListLink() throws Exception {
|
||||
assertEquals(tvrage.getEpisodeListLink(testResult, 1).toString(), "http://www.tvrage.com/Buffy_The_Vampire_Slayer/episode_list/1");
|
||||
assertEquals(tvrage.getEpisodeListLink(buffySearchResult, 1).toString(), "http://www.tvrage.com/Buffy_The_Vampire_Slayer/episode_list/1");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeListLinkAll() throws Exception {
|
||||
assertEquals(tvrage.getEpisodeListLink(testResult).toString(), "http://www.tvrage.com/Buffy_The_Vampire_Slayer/episode_list/all");
|
||||
assertEquals(tvrage.getEpisodeListLink(buffySearchResult).toString(), "http://www.tvrage.com/Buffy_The_Vampire_Slayer/episode_list/all");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue