use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class SVPlanDemoTest method demoTest3.
@Test
public void demoTest3() throws IOException, JSONException {
List<Document> docs = new ArrayList<>();
docs.add(Jsoup.parse(html3));
SubstitutionSchedule schedule = parser.parseSVPlanSchedule(docs);
assertEquals(new LocalDateTime(2017, 5, 2, 7, 19), schedule.getLastChange());
assertEquals(1, schedule.getDays().size());
SubstitutionScheduleDay day = schedule.getDays().get(0);
assertEquals(new LocalDate(2017, 5, 2), day.getDate());
assertEquals(32, day.getSubstitutions().size());
assertEquals(0, day.getMessages().size());
for (Substitution subst : day.getSubstitutions()) {
if (!subst.getSubject().equals("Profi"))
assertTrue(subst.getClasses().size() >= 1);
assertNotEmpty(subst.getLesson());
assertNullOrNotEmpty(subst.getPreviousSubject());
assertNotEmpty(subst.getSubject());
assertNullOrNotEmpty(subst.getRoom());
assertNullOrNotEmpty(subst.getTeacher());
assertNullOrNotEmpty(subst.getPreviousTeacher());
assertNullOrNotEmpty(subst.getDesc());
assertNotEmpty(subst.getType());
}
}
use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class SVPlanDemoTest method demoTest1.
@Test
public void demoTest1() throws IOException, JSONException {
List<Document> docs = new ArrayList<>();
docs.add(Jsoup.parse(html1));
SubstitutionSchedule schedule = parser.parseSVPlanSchedule(docs);
assertEquals(new LocalDateTime(2016, 9, 2, 11, 10), schedule.getLastChange());
assertEquals(5, schedule.getDays().size());
SubstitutionScheduleDay day = schedule.getDays().get(0);
assertEquals(new LocalDate(2016, 9, 2), day.getDate());
assertEquals(14, day.getSubstitutions().size());
assertEquals(1, day.getMessages().size());
assertEquals("Ordnungsdienst:9BR<br>", day.getMessages().get(0));
for (Substitution subst : day.getSubstitutions()) {
assertTrue(subst.getClasses().size() == 1);
assertNotEmpty(subst.getLesson());
assertNullOrNotEmpty(subst.getPreviousSubject());
assertNotEmpty(subst.getSubject());
assertNullOrNotEmpty(subst.getRoom());
assertNullOrNotEmpty(subst.getTeacher());
assertNullOrNotEmpty(subst.getPreviousTeacher());
assertNullOrNotEmpty(subst.getDesc());
assertNotEmpty(subst.getType());
}
}
use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class SVPlanDemoTest method demoTest2.
@Test
public void demoTest2() throws IOException, JSONException {
List<Document> docs = new ArrayList<>();
docs.add(Jsoup.parse(html2));
SubstitutionSchedule schedule = parser.parseSVPlanSchedule(docs);
assertEquals(new LocalDateTime(2016, 11, 6, 19, 36, 18), schedule.getLastChange());
assertEquals(1, schedule.getDays().size());
SubstitutionScheduleDay day = schedule.getDays().get(0);
assertEquals(new LocalDate(2016, 11, 7), day.getDate());
assertEquals(19, day.getSubstitutions().size());
assertEquals(1, day.getMessages().size());
assertEquals("Sprechtag Frau Fildebrandt (Klasse 9).", day.getMessages().get(0));
for (Substitution subst : day.getSubstitutions()) {
assertTrue(subst.getClasses().size() == 1);
assertNotEmpty(subst.getLesson());
assertNullOrNotEmpty(subst.getPreviousSubject());
assertNotEmpty(subst.getSubject());
assertNullOrNotEmpty(subst.getRoom());
assertNullOrNotEmpty(subst.getTeacher());
assertNullOrNotEmpty(subst.getPreviousTeacher());
assertNullOrNotEmpty(subst.getDesc());
assertNotEmpty(subst.getType());
}
}
use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class SVPlanDemoTest method demoTest4.
@Test
public void demoTest4() throws IOException, JSONException {
List<Document> docs = new ArrayList<>();
docs.add(Jsoup.parse(html4));
SubstitutionSchedule schedule = parser.parseSVPlanSchedule(docs);
for (Substitution subst : schedule.getDays().get(0).getSubstitutions()) {
assertTrue(subst.getClasses().size() == 1);
}
SubstitutionSchedule schedule2 = parserWithoutRepeat.parseSVPlanSchedule(docs);
for (Substitution subst : schedule2.getDays().get(0).getSubstitutions()) {
if (subst.getSubject().equals("Netzw")) {
assertTrue(subst.getClasses().size() == 0);
} else {
assertTrue(subst.getClasses().size() == 1);
}
}
}
use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class UntisCommonParserTest method testHandleRoomBothSpan.
@Test
public void testHandleRoomBothSpan() throws Exception {
Substitution subst = new Substitution();
Element cell = Jsoup.parse("<table><td><span style=\"color: #010101\"><s>248</s>?236</span></td></table>").select("td").first();
UntisCommonParser.handleRoom(subst, cell);
assertEquals("248", subst.getPreviousRoom());
assertEquals("236", subst.getRoom());
}
Aggregations