-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
import static org.junit.Assert.*;
+import java.util.Calendar;
+import java.util.Date;
import java.util.List;
import org.junit.After;
}
@Test
- public void testGetProgrammesListOfChannelInt() {
+ public void testgetChannels() {
List<Channel> channels = rtl.getChannels();
+ // there should be a least 20 channels
+ assertTrue("There should be at least 20 channels from rtl.nl", channels.size()>=20);
// there should be an "RTL 4" channel
boolean foundRTL4 = false;
for(Channel c: channels) {
}
}
+ @Test
+ public void testFindGTSTRerun() throws Exception {
+ List<Channel> channels = rtl.getChannels();
+
+ Channel rtl4 = null;
+ for(Channel c: channels) {
+ if(c.defaultName().equals("RTL 4")) {
+ rtl4 = c;
+ }
+ }
+ assertNotNull("Should be able to find RTL 4 channel", rtl4);
+
+ List<Programme> today = rtl.getProgrammes(rtl4, 0);
+ assertTrue("Expect at leat 10 programmes for a day", today.size()>=10);
+
+ Calendar now = Calendar.getInstance();
+ if(now.get(Calendar.MONTH)<=Calendar.MAY || now.get(Calendar.MONTH)>=Calendar.SEPTEMBER) {
+ int offset;
+ switch(now.get(Calendar.DAY_OF_WEEK)) {
+ case Calendar.SATURDAY: offset = 2; break;
+ case Calendar.SUNDAY: offset = 1; break;
+ default: offset = 0;
+ }
+ int rerun;
+ switch(now.get(Calendar.DAY_OF_WEEK)) {
+ case Calendar.FRIDAY: rerun = 3; break;
+ case Calendar.SATURDAY: rerun = 2; break;
+ default: rerun = 1;
+ }
+ List<Programme> first = rtl.getProgrammes(rtl4, offset);
+ Programme gtstOriginal = null;
+ for(Programme p: first) {
+ if(p.getFirstTitle().matches("Goede Tijden.*")) {
+ if (p.startTime.getHours()>=19) {
+ gtstOriginal = p;
+ break;
+ }
+ }
+ }
+ assertNotNull("Should have a programme called Goede Tijden, Slechte Tijden after 19:00 on date with offset "+offset+ " for today", gtstOriginal);
+ System.out.println(gtstOriginal.toString());
+
+ List<Programme> reruns = rtl.getProgrammes(rtl4, rerun);
+ Programme gtstRerun = null;
+ for(Programme p: reruns) {
+ if(p.getFirstTitle().matches("Goede Tijden.*")) {
+ if (p.startTime.getHours()<=15) {
+ gtstRerun = p;
+ break;
+ }
+ }
+ }
+ assertNotNull("Should have a programme called Goede Tijden, Slechte Tijden before 15:00 on date with offset "+rerun, gtstRerun);
+
+ assertEquals("GTST rerun should have the same description as the original", gtstRerun.descriptions.get(0).title, gtstOriginal.descriptions.get(0).title);
+ }
+
+
+
+
+ }
}