use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class UntisCommonParserTest method testHandleRoomSingle.
@Test
public void testHandleRoomSingle() throws Exception {
Substitution subst = new Substitution();
Element cell = Jsoup.parse("<table><td>224</td></table>").select("td").first();
UntisCommonParser.handleRoom(subst, cell);
assertEquals(null, subst.getPreviousRoom());
assertEquals("224", subst.getRoom());
}
use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class UntisCommonParserTest method testHandleRoomSinglePrevious.
@Test
public void testHandleRoomSinglePrevious() throws Exception {
Substitution subst = new Substitution();
Element cell = Jsoup.parse("<table><td><s>264</s></td></table>").select("td").first();
UntisCommonParser.handleRoom(subst, cell);
assertEquals("264", subst.getPreviousRoom());
assertEquals(null, subst.getRoom());
}
use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class SubstitutionTextUtilsTest method testSubstitutionDiffText.
@Theory
public void testSubstitutionDiffText(@Strings(values = { "", "Fach" }) String subject1, @Strings(values = { "", "vorheriges Fach" }) String previousSubject1, @Strings(values = { "", "Lehrer" }) String teacher1, @Strings(values = { "", "vorheriger Lehrer" }) String previousTeacher1, @Strings(values = { "", "Raum" }) String room1, @Strings(values = { "", "vorheriger Raum" }) String previousRoom1, @Strings(values = { "", "Beschreibung" }) String desc1, @Strings(values = { "", "Fach", "Fach2" }) String subject2, @Strings(values = { "", "vorheriges Fach", "vorheriges Fach2" }) String previousSubject2, @Strings(values = { "", "Lehrer", "Lehrer2" }) String teacher2, @Strings(values = { "", "vorheriger Lehrer", "vorheriger Lehrer2" }) String previousTeacher2, @Strings(values = { "", "Raum", "Raum2" }) String room2, @Strings(values = { "", "vorheriger Raum", "vorheriger Raum2" }) String previousRoom2, @Strings(values = { "", "Beschreibung", "Beschreibung2" }) String desc2) throws Exception {
assumeTrue(bothOrNoneEmpty(subject1, subject2));
assumeTrue(bothOrNoneEmpty(previousSubject1, previousSubject2));
assumeTrue(bothOrNoneEmpty(teacher1, teacher2));
assumeTrue(bothOrNoneEmpty(previousTeacher1, previousTeacher2));
assumeTrue(bothOrNoneEmpty(room1, room2));
assumeTrue(bothOrNoneEmpty(previousRoom1, previousRoom2));
assumeTrue(bothOrNoneEmpty(desc1, desc2));
assumeTrue(complexity(subject1, subject2, previousSubject1, previousSubject2, teacher1, teacher2, previousTeacher1, previousTeacher2, room1, room2, previousRoom1, previousRoom2, desc1, desc2) <= SubstitutionDiff.MAX_COMPLEXITY);
Substitution subst1 = new Substitution();
subst1.setSubject(subject1);
subst1.setPreviousSubject(previousSubject1);
subst1.setTeacher(teacher1);
subst1.setPreviousTeacher(previousTeacher1);
subst1.setRoom(room1);
subst1.setPreviousRoom(previousRoom1);
subst1.setDesc(desc1);
Substitution subst2 = new Substitution();
subst2.setSubject(subject2);
subst2.setPreviousSubject(previousSubject2);
subst2.setTeacher(teacher2);
subst2.setPreviousTeacher(previousTeacher2);
subst2.setRoom(room2);
subst2.setPreviousRoom(previousRoom2);
subst2.setDesc(desc2);
SubstitutionDiff diff = new SubstitutionDiff();
diff.setOldSubstitution(subst1);
diff.setNewSubstitution(subst2);
String text = SubstitutionTextUtils.getText(diff);
/*if (hasData(subject) || hasData(previousSubject) || hasData(teacher) || hasData(previousTeacher) ||
hasData(room) || hasData(previousRoom) || hasData(desc)) {
assertNotEquals(text, "");
}*/
// System.out.println(text);
}
use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class SubstitutionTextUtilsTest method testSubstitutionText.
@Theory
public void testSubstitutionText(@Strings(values = { "", "Fach" }) String subject, @Strings(values = { "", "vorheriges Fach" }) String previousSubject, @Strings(values = { "", "Lehrer" }) String teacher, @Strings(values = { "", "vorheriger Lehrer" }) String previousTeacher, @Strings(values = { "", "Raum" }) String room, @Strings(values = { "", "vorheriger Raum" }) String previousRoom, @Strings(values = { "", "Beschreibung" }) String desc) throws Exception {
Substitution subst = new Substitution();
subst.setSubject(subject);
subst.setPreviousSubject(previousSubject);
subst.setTeacher(teacher);
subst.setPreviousTeacher(previousTeacher);
subst.setRoom(room);
subst.setPreviousRoom(previousRoom);
subst.setDesc(desc);
String text = SubstitutionTextUtils.getText(subst);
if (hasData(subject) || hasData(previousSubject) || hasData(teacher) || hasData(previousTeacher) || hasData(room) || hasData(previousRoom) || hasData(desc)) {
assertNotEquals(text, "");
}
// System.out.println(text);
}
use of me.vertretungsplan.objects.Substitution in project substitution-schedule-parser by vertretungsplanme.
the class SubstitutionTextUtilsTest2 method testGetTeachers3.
@Test
public void testGetTeachers3() {
Substitution s = new Substitution();
s.setTeacher(null);
s.setPreviousTeacher("A");
assertEquals("A", SubstitutionTextUtils.getTeachers(s));
}
Aggregations