use of me.vertretungsplan.objects.SubstitutionScheduleDay 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.SubstitutionScheduleDay 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.SubstitutionScheduleDay in project substitution-schedule-parser by vertretungsplanme.
the class DiffTest method testDiffSame.
@Test
public void testDiffSame() {
Substitution s1 = new Substitution();
s1.setClasses(new HashSet<>(Arrays.asList(new String[] { "07B" })));
s1.setLesson("6");
s1.setType("Enfall");
s1.setSubject("Entfall");
s1.setPreviousSubject("SPA");
s1.setTeachers(new HashSet<>(Arrays.asList(new String[] { "KW", "ER" })));
s1.setPreviousTeachers(new HashSet<String>());
s1.setColor("#F44336");
s1.setDesc("fällt aus");
Substitution s2 = new Substitution();
s2.setClasses(new HashSet<>(Arrays.asList(new String[] { "07B" })));
s2.setLesson("6");
s2.setType("Enfall");
s2.setSubject("Entfall");
s2.setPreviousSubject("SPA");
s2.setTeachers(new HashSet<>(Arrays.asList(new String[] { "KW", "ER" })));
s2.setPreviousTeachers(new HashSet<String>());
s2.setColor("#F44336");
s2.setDesc("fällt aus");
assertTrue(s1.equals(s2));
SubstitutionScheduleDay d1 = new SubstitutionScheduleDay();
d1.addSubstitution(s1);
SubstitutionScheduleDay d2 = new SubstitutionScheduleDay();
d2.addSubstitution(s2);
SubstitutionScheduleDayDiff dayDiff = SubstitutionScheduleDayDiff.compare(d1, d2);
assertTrue(!dayDiff.isNotEmpty());
}
use of me.vertretungsplan.objects.SubstitutionScheduleDay in project substitution-schedule-parser by vertretungsplanme.
the class CSVDemoTest method demoTest.
@Test
public void demoTest() throws IOException, JSONException {
SubstitutionSchedule schedule = parser.parseCSV(csv);
assertEquals(2, schedule.getDays().size());
SubstitutionScheduleDay day = schedule.getDays().get(0);
assertEquals(new LocalDate(2016, 9, 5), day.getDate());
assertEquals(new LocalDateTime(2016, 9, 2, 8, 16), day.getLastChange());
assertEquals(1, day.getSubstitutions().size());
assertEquals(0, day.getMessages().size());
Substitution subst = day.getSubstitutions().iterator().next();
assertEquals(1, subst.getClasses().size());
assertEquals("05A", subst.getClasses().iterator().next());
assertEquals("6", subst.getLesson());
assertEquals("!Ma", subst.getSubject());
assertEquals("!DROE", subst.getTeacher());
assertEquals("!B203", subst.getRoom());
assertEquals("für Mu REN", subst.getDesc());
assertEquals("Vertretung", subst.getType());
}
use of me.vertretungsplan.objects.SubstitutionScheduleDay in project substitution-schedule-parser by vertretungsplanme.
the class SubstitutionScheduleDiff method filterDaysTeacher.
private void filterDaysTeacher(String teacher, Set<String> excludedSubjects, List<SubstitutionScheduleDay> days) {
for (int i = 0; i < days.size(); i++) {
SubstitutionScheduleDay day = days.get(i);
SubstitutionScheduleDay filteredDay = day.clone();
filteredDay.setSubstitutions(day.getSubstitutionsByTeacherAndExcludedSubject(teacher, excludedSubjects));
days.set(i, filteredDay);
}
}
Aggregations