Search in sources :

Example 11 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class LegionBoardDemoTest method setUp.

@Before
public void setUp() throws JSONException {
    changes = new JSONArray(readResource("/legionboard/changes.json"));
    teachers = new JSONArray(readResource("/legionboard/teachers.json"));
    courses = new JSONArray(readResource("/legionboard/courses.json"));
    SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    scheduleData.setData(new JSONObject());
    parser = new LegionBoardParser(scheduleData, null);
    DateTimeUtils.setCurrentMillisFixed(new LocalDate(2016, 9, 2).toDateTimeAtStartOfDay().getMillis());
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) LocalDate(org.joda.time.LocalDate) Before(org.junit.Before)

Example 12 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class SVPlanDemoTest method setUp.

@Before
public void setUp() throws JSONException {
    html1 = readResource("/svplan/svplan1.html");
    html2 = readResource("/svplan/svplan2.html");
    html3 = readResource("/svplan/svplan3.html");
    html4 = readResource("/svplan/svplan4.html");
    SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    scheduleData.setData(new JSONObject());
    SubstitutionScheduleData scheduleData2 = new SubstitutionScheduleData();
    scheduleData2.setData(new JSONObject("{\"repeatClass\": false}"));
    parser = new SVPlanParser(scheduleData, null);
    parserWithoutRepeat = new SVPlanParser(scheduleData2, null);
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) Before(org.junit.Before)

Example 13 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class SVPlanTest method setUp.

@Before
public void setUp() throws JSONException {
    SubstitutionScheduleData data = new SubstitutionScheduleData();
    final JSONObject json = new JSONObject();
    final JSONArray classes = new JSONArray();
    classes.put("7a");
    classes.put("8a");
    classes.put("8b");
    classes.put("9a");
    classes.put("10a");
    json.put("classes", classes);
    data.setData(json);
    data.setType(SubstitutionSchedule.Type.STUDENT);
    parser = new SVPlanParser(data, null);
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) Before(org.junit.Before)

Example 14 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class UntisInfoDemoTest method setUp.

@Before
public void setUp() throws JSONException {
    doc = Jsoup.parse(readResource("/untis-info/schedule1.html"));
    scheduleData = new SubstitutionScheduleData();
    scheduleData.setData(new JSONObject("{\"classesSeparated\": true }"));
    scheduleData.setType(SubstitutionSchedule.Type.STUDENT);
    parser = new UntisInfoParser(scheduleData, null);
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) Before(org.junit.Before)

Example 15 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class ColorProviderTest method testCustomColor.

@Test
public void testCustomColor() throws JSONException {
    final SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    final JSONObject data = new JSONObject();
    final JSONObject colors = new JSONObject();
    final JSONArray values = new JSONArray();
    values.put("Vertretung");
    colors.put("#123456", values);
    data.put("colors", colors);
    scheduleData.setData(data);
    final ColorProvider provider = new ColorProvider(scheduleData);
    assertEquals("#123456", provider.getColor("Vertretung"));
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) Test(org.junit.Test)

Aggregations

SubstitutionScheduleData (me.vertretungsplan.objects.SubstitutionScheduleData)16 JSONObject (org.json.JSONObject)15 Before (org.junit.Before)9 JSONArray (org.json.JSONArray)6 Test (org.junit.Test)5 LocalDate (org.joda.time.LocalDate)4 SubstitutionSchedule (me.vertretungsplan.objects.SubstitutionSchedule)2 SubstitutionScheduleDay (me.vertretungsplan.objects.SubstitutionScheduleDay)1 NoAuthenticationData (me.vertretungsplan.objects.authentication.NoAuthenticationData)1 NotNull (org.jetbrains.annotations.NotNull)1 LocalDateTime (org.joda.time.LocalDateTime)1 Document (org.jsoup.nodes.Document)1