added junit test for TimetableParser
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
* this also is release 1.1.4 (api version 1.1.2) * closes issue #5
This commit is contained in:
@ -31,15 +31,30 @@ class TimetableParserTest {
|
||||
|
||||
@Test
|
||||
fun parseTimetableNormalWeek() {
|
||||
// TODO
|
||||
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 actualTimetable = TimetableParser().parseTimeTable(htmlDoc).toString().trim()
|
||||
val expectedTimetable = File(TimetableParserTest::class.java.getResource("/expected/Timetable_normal-week_expected.txt").toURI()).readText().trim()
|
||||
|
||||
Assertions.assertEquals(expectedTimetable, actualTimetable)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parseTimetableEmptyWeek() {
|
||||
val htmlFile = File(TimetableParserTest::class.java.getResource("/html/Timetable_empty-week.html").path)
|
||||
val htmlDoc = Jsoup.parse(htmlFile,"UTF-8", "https://www.hs-offenburg.de/")
|
||||
val actualTimetable = TimetableParser().parseTimeTable(htmlDoc).toString().trim()
|
||||
val expectedTimetable = File(TimetableParserTest::class.java.getResource("/expected/Timetable_empty-week_expected.txt").toURI()).readText().trim()
|
||||
|
||||
Assertions.assertEquals(expectedTimetable, actualTimetable)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parseWeekNumberYear() {
|
||||
val htmlFile = File(MensaParserTest::class.java.getResource("/html/Timetable_normal-week.html").path)
|
||||
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 weekNumberYear = TimetableParser().parseWeekNumberYear(htmlDoc)
|
||||
val actualWeekNumberYear = TimetableParser().parseWeekNumberYear(htmlDoc)
|
||||
|
||||
Assertions.assertEquals(42, weekNumberYear)
|
||||
Assertions.assertEquals(42, actualWeekNumberYear)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user