use of me.vertretungsplan.objects.SubstitutionSchedule in project substitution-schedule-parser by vertretungsplanme.
the class IndiwareDemoTest method testHTMLEmbeddedContentSelector.
@Test
public void testHTMLEmbeddedContentSelector() throws JSONException, IOException {
String html = readResource("/indiware/indiware_embedded.html");
SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
final JSONObject data = new JSONObject();
data.put("embeddedContentSelector", ".items-leading .dd-article > table > tbody > tr > td");
scheduleData.setData(data);
IndiwareParser parser = new IndiwareParser(scheduleData, null);
SubstitutionSchedule schedule = new SubstitutionSchedule();
parser.parseIndiwarePage(schedule, html);
assertEquals(2, schedule.getDays().size());
assertEquals(new LocalDate(2017, 3, 10), schedule.getDays().get(0).getDate());
assertEquals(new LocalDate(2017, 3, 13), schedule.getDays().get(1).getDate());
}
use of me.vertretungsplan.objects.SubstitutionSchedule in project substitution-schedule-parser by vertretungsplanme.
the class IndiwareDemoTest method testHTMLSplit.
@Test
public void testHTMLSplit() throws JSONException, IOException {
String html = readResource("/indiware/indiware_split.html");
SubstitutionSchedule schedule = new SubstitutionSchedule();
parser.parseIndiwarePage(schedule, html);
assertEquals(2, schedule.getDays().size());
assertEquals(new LocalDate(2017, 3, 10), schedule.getDays().get(0).getDate());
assertEquals(new LocalDate(2017, 3, 13), schedule.getDays().get(1).getDate());
}
use of me.vertretungsplan.objects.SubstitutionSchedule in project substitution-schedule-parser by vertretungsplanme.
the class UntisInfoDemoTest method demoTest.
@Test
public void demoTest() throws IOException, JSONException, CredentialInvalidException {
SubstitutionSchedule schedule = SubstitutionSchedule.fromData(scheduleData);
parser.parseSubstitutionDays(schedule, "29.06.2017 12:10", doc, null, new ArrayList<String>());
assertEquals(2, schedule.getDays().size());
if (schedule.getDays().get(0).getSubstitutions().size() == 31) {
assertEquals(24, schedule.getDays().get(1).getSubstitutions().size());
} else {
assertEquals(31, schedule.getDays().get(1).getSubstitutions().size());
assertEquals(24, schedule.getDays().get(0).getSubstitutions().size());
}
}
use of me.vertretungsplan.objects.SubstitutionSchedule in project substitution-schedule-parser by vertretungsplanme.
the class DaVinciDemoTest method singleTest5.
@Test
public void singleTest5() throws IOException, JSONException {
SubstitutionSchedule schedule = new SubstitutionSchedule();
DaVinciParser.parsePage(Jsoup.parse(htmlSingleDaVinci5), schedule, parser.colorProvider);
assertEquals(3, schedule.getDays().size());
assertEquals(new LocalDateTime(2017, 1, 17, 7, 32), schedule.getLastChange());
SubstitutionScheduleDay day = schedule.getDays().get(0);
assertEquals(new LocalDate(2017, 1, 17), day.getDate());
assertEquals(2, day.getSubstitutions().size());
assertEquals(0, day.getMessages().size());
checkSubstitutions(day);
}
use of me.vertretungsplan.objects.SubstitutionSchedule in project substitution-schedule-parser by vertretungsplanme.
the class DaVinciDemoTest method singleTest6.
@Test
public void singleTest6() throws IOException, JSONException {
SubstitutionSchedule schedule = new SubstitutionSchedule();
DaVinciParser.parsePage(Jsoup.parse(htmlSingle), schedule, parser.colorProvider);
SubstitutionScheduleDay day = schedule.getDays().get(0);
assertEquals(new LocalDate(2016, 9, 5), day.getDate());
assertEquals(new LocalDateTime(2016, 9, 2, 13, 32), day.getLastChange());
assertEquals(23, day.getSubstitutions().size());
assertEquals(0, day.getMessages().size());
checkSubstitutions(day);
}
Aggregations