Search in sources :

Example 1 with SubstitutionDiff

use of me.vertretungsplan.objects.diff.SubstitutionDiff 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);
}
Also used : Substitution(me.vertretungsplan.objects.Substitution) SubstitutionDiff(me.vertretungsplan.objects.diff.SubstitutionDiff)

Aggregations

Substitution (me.vertretungsplan.objects.Substitution)1 SubstitutionDiff (me.vertretungsplan.objects.diff.SubstitutionDiff)1