TimetableParser: parse year
All checks were successful
continuous-integration/woodpecker the build was successful

This also adds the parsed year to the meta object included in the timetable response
This commit is contained in:
2021-10-23 23:39:18 +02:00
parent dc57a0d0c1
commit d863f4fb1e
4 changed files with 21 additions and 11 deletions

View File

@ -25,6 +25,7 @@ package org.mosad.thecitadelofricks.hsoparser
import org.jsoup.Jsoup
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mosad.thecitadelofricks.CalendarWeek
import java.io.File
class TimetableParserTest {
@ -50,11 +51,11 @@ class TimetableParserTest {
}
@Test
fun parseWeekNumberYear() {
fun parseCalendarWeek() {
val htmlFile = File(TimetableParserTest::class.java.getResource("/html/Timetable_normal-week.html").path)
val htmlDoc = Jsoup.parse(htmlFile, "UTF-8", "https://www.hs-offenburg.de/")
val actualWeekNumberYear = TimetableParser(htmlDoc = htmlDoc).parseWeekNumberYear()
val actualCalendarWeek = TimetableParser(htmlDoc = htmlDoc).parseCalendarWeek()
Assertions.assertEquals(42, actualWeekNumberYear)
Assertions.assertEquals(CalendarWeek(42, 2019), actualCalendarWeek)
}
}