Update unit tests
This commit is contained in:
parent
f80534ba5e
commit
7d50f2fac4
|
@ -21,8 +21,8 @@ public class EpisodeMetricsTest {
|
||||||
File fY1T1 = new File("Doctor Who (2005)/Doctor Who - 1x01 - Rose");
|
File fY1T1 = new File("Doctor Who (2005)/Doctor Who - 1x01 - Rose");
|
||||||
File fY2T2 = new File("Doctor Who (1963)/Doctor Who - 1x01 - An Unearthly Child");
|
File fY2T2 = new File("Doctor Who (1963)/Doctor Who - 1x01 - An Unearthly Child");
|
||||||
|
|
||||||
assertEquals(2.0 / 3, SubstringFields.getSimilarity(eY1T1, fY1T1), 0.01);
|
assertEquals(3.0 / 3, SubstringFields.getSimilarity(eY1T1, fY1T1), 0.01);
|
||||||
assertEquals(1.0 / 3, SubstringFields.getSimilarity(eY1T1, fY2T2), 0.01);
|
assertEquals(2.0 / 3, SubstringFields.getSimilarity(eY1T1, fY2T2), 0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -31,8 +31,8 @@ public class SeriesNameMatcherTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void matchBeforeSeasonEpisodePattern() {
|
public void matchBeforeSeasonEpisodePattern() {
|
||||||
assertEquals("The Test", matcher.matchByEpisodeIdentifier("The Test - 1x01"));
|
assertEquals("The Test -", matcher.matchByEpisodeIdentifier("The Test - 1x01"));
|
||||||
assertEquals("Mushishi", matcher.matchByEpisodeIdentifier("Mushishi_-_1x01_-_The_Green_Gathering"));
|
assertEquals("Mushishi_-_", matcher.matchByEpisodeIdentifier("Mushishi_-_1x01_-_The_Green_Gathering"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
package net.filebot.util;
|
package net.filebot.util;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
@ -18,7 +17,6 @@ import org.junit.Test;
|
||||||
import net.filebot.util.PreferencesMap.SerializableAdapter;
|
import net.filebot.util.PreferencesMap.SerializableAdapter;
|
||||||
import net.filebot.util.PreferencesMap.SimpleAdapter;
|
import net.filebot.util.PreferencesMap.SimpleAdapter;
|
||||||
|
|
||||||
|
|
||||||
public class PreferencesMapTest {
|
public class PreferencesMapTest {
|
||||||
|
|
||||||
private static Preferences root;
|
private static Preferences root;
|
||||||
|
@ -27,7 +25,6 @@ public class PreferencesMapTest {
|
||||||
private static Preferences temp;
|
private static Preferences temp;
|
||||||
private static Preferences sequence;
|
private static Preferences sequence;
|
||||||
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpBeforeClass() throws Exception {
|
public static void setUpBeforeClass() throws Exception {
|
||||||
root = Preferences.userRoot().node("junit-test");
|
root = Preferences.userRoot().node("junit-test");
|
||||||
|
@ -52,13 +49,11 @@ public class PreferencesMapTest {
|
||||||
temp = root.node("temp");
|
temp = root.node("temp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void tearDownAfterClass() throws Exception {
|
public static void tearDownAfterClass() throws Exception {
|
||||||
root.removeNode();
|
root.removeNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void get() {
|
public void get() {
|
||||||
Map<String, String> stringMap = PreferencesMap.map(strings);
|
Map<String, String> stringMap = PreferencesMap.map(strings);
|
||||||
|
@ -66,7 +61,6 @@ public class PreferencesMapTest {
|
||||||
assertEquals("Firefly", stringMap.get("1"));
|
assertEquals("Firefly", stringMap.get("1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void put() {
|
public void put() {
|
||||||
Map<String, String> stringMap = PreferencesMap.map(temp);
|
Map<String, String> stringMap = PreferencesMap.map(temp);
|
||||||
|
@ -76,7 +70,6 @@ public class PreferencesMapTest {
|
||||||
assertEquals("snake", temp.get("key", null));
|
assertEquals("snake", temp.get("key", null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void remove() throws Exception {
|
public void remove() throws Exception {
|
||||||
Map<String, Integer> map = PreferencesMap.map(numbers, SimpleAdapter.forClass(Integer.class));
|
Map<String, Integer> map = PreferencesMap.map(numbers, SimpleAdapter.forClass(Integer.class));
|
||||||
|
@ -86,7 +79,6 @@ public class PreferencesMapTest {
|
||||||
assertFalse(Arrays.asList(numbers.keys()).contains("A"));
|
assertFalse(Arrays.asList(numbers.keys()).contains("A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clear() throws Exception {
|
public void clear() throws Exception {
|
||||||
Map<String, Integer> map = PreferencesMap.map(temp, SimpleAdapter.forClass(Integer.class));
|
Map<String, Integer> map = PreferencesMap.map(temp, SimpleAdapter.forClass(Integer.class));
|
||||||
|
@ -98,7 +90,6 @@ public class PreferencesMapTest {
|
||||||
assertTrue(temp.keys().length == 0);
|
assertTrue(temp.keys().length == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void containsKey() {
|
public void containsKey() {
|
||||||
temp.put("name", "kaya");
|
temp.put("name", "kaya");
|
||||||
|
@ -108,7 +99,6 @@ public class PreferencesMapTest {
|
||||||
assertTrue(map.containsKey("name"));
|
assertTrue(map.containsKey("name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void values() {
|
public void values() {
|
||||||
|
|
||||||
|
@ -121,7 +111,6 @@ public class PreferencesMapTest {
|
||||||
assertTrue(list.contains(3));
|
assertTrue(list.contains(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void containsValue() {
|
public void containsValue() {
|
||||||
Map<String, String> map = PreferencesMap.map(strings);
|
Map<String, String> map = PreferencesMap.map(strings);
|
||||||
|
@ -129,7 +118,6 @@ public class PreferencesMapTest {
|
||||||
assertTrue(map.containsValue("Firefly"));
|
assertTrue(map.containsValue("Firefly"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void entrySet() {
|
public void entrySet() {
|
||||||
Map<String, Integer> map = PreferencesMap.map(numbers, SimpleAdapter.forClass(Integer.class));
|
Map<String, Integer> map = PreferencesMap.map(numbers, SimpleAdapter.forClass(Integer.class));
|
||||||
|
@ -142,13 +130,6 @@ public class PreferencesMapTest {
|
||||||
assertEquals(5, numbers.getInt("M", -1));
|
assertEquals(5, numbers.getInt("M", -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
|
||||||
public void adapterException() {
|
|
||||||
PreferencesMap.map(strings, SimpleAdapter.forClass(Integer.class)).values();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void containsKeyWithObjectKey() throws Exception {
|
public void containsKeyWithObjectKey() throws Exception {
|
||||||
Map<String, String> map = PreferencesMap.map(strings);
|
Map<String, String> map = PreferencesMap.map(strings);
|
||||||
|
@ -156,14 +137,12 @@ public class PreferencesMapTest {
|
||||||
assertFalse(map.containsKey(new Object()));
|
assertFalse(map.containsKey(new Object()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getWithObjectKey() throws Exception {
|
public void getWithObjectKey() throws Exception {
|
||||||
Map<String, String> map = PreferencesMap.map(strings);
|
Map<String, String> map = PreferencesMap.map(strings);
|
||||||
|
|
||||||
assertEquals(null, map.get(new Object()));
|
assertEquals(null, map.get(new Object()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serializableAdapter() {
|
public void serializableAdapter() {
|
||||||
Map<String, Color> map = PreferencesMap.map(temp, new SerializableAdapter<Color>());
|
Map<String, Color> map = PreferencesMap.map(temp, new SerializableAdapter<Color>());
|
||||||
|
|
|
@ -30,13 +30,10 @@ public class TheTVDBClientTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void searchGerman() throws Exception {
|
public void searchGerman() throws Exception {
|
||||||
List<SearchResult> results = db.search("Buffy the Vampire Slayer", Locale.GERMAN);
|
List<SearchResult> results = db.search("Buffy", Locale.GERMAN);
|
||||||
|
|
||||||
assertEquals(2, results.size());
|
|
||||||
|
|
||||||
SearchResult first = results.get(0);
|
SearchResult first = results.get(0);
|
||||||
|
assertEquals("Buffy", first.getName());
|
||||||
assertEquals("Buffy the Vampire Slayer", first.getName());
|
|
||||||
assertEquals(70327, first.getId());
|
assertEquals(70327, first.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +131,7 @@ public class TheTVDBClientTest {
|
||||||
assertEquals("tt0934814", it.getImdbId());
|
assertEquals("tt0934814", it.getImdbId());
|
||||||
assertEquals("Friday", it.getAirsDayOfWeek());
|
assertEquals("Friday", it.getAirsDayOfWeek());
|
||||||
assertEquals("8:00 PM", it.getAirsTime());
|
assertEquals("8:00 PM", it.getAirsTime());
|
||||||
assertEquals(1000, it.getOverview().length(), 100);
|
assertEquals(500, it.getOverview().length(), 100);
|
||||||
assertEquals("http://thetvdb.com/banners/graphical/80348-g26.jpg", it.getBannerUrl().toString());
|
assertEquals("http://thetvdb.com/banners/graphical/80348-g26.jpg", it.getBannerUrl().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue