Add constants with day offests in timetable tests
(cherry picked from commit f66cac410a
)
This commit is contained in:
parent
626aba256d
commit
66ae9f09b6
1 changed files with 31 additions and 23 deletions
|
@ -20,6 +20,14 @@ class TimetableTest : BaseLocalTest() {
|
||||||
runBlocking { getStudentRepo(TimetableTest::class.java, "PlanLekcji.json").getTimetableAdditional(getLocalDate(2020, 10, 9)) }
|
runBlocking { getStudentRepo(TimetableTest::class.java, "PlanLekcji.json").getTimetableAdditional(getLocalDate(2020, 10, 9)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val MONDAY_OFFSET = 0
|
||||||
|
private const val TUESDAY_OFFSET = 5
|
||||||
|
private const val WEDNESDAY_OFFSET = 10
|
||||||
|
private const val THURSDAY_OFFSET = 15
|
||||||
|
private const val FRIDAY_OFFSET = 19
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getTimetableTest() {
|
fun getTimetableTest() {
|
||||||
assertEquals(23, timetable.size)
|
assertEquals(23, timetable.size)
|
||||||
|
@ -28,7 +36,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getSimpleLesson() {
|
fun getSimpleLesson() {
|
||||||
with(timetable[0]) {
|
with(timetable[MONDAY_OFFSET]) {
|
||||||
// poniedziałek, 0
|
// poniedziałek, 0
|
||||||
assertEquals(0, number)
|
assertEquals(0, number)
|
||||||
assertEquals(getDate(2018, 9, 24, 7, 10, 0), start)
|
assertEquals(getDate(2018, 9, 24, 7, 10, 0), start)
|
||||||
|
@ -51,7 +59,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getSimpleLesson_canceled() {
|
fun getSimpleLesson_canceled() {
|
||||||
with(timetable[5]) {
|
with(timetable[TUESDAY_OFFSET]) {
|
||||||
// wtorek, 0
|
// wtorek, 0
|
||||||
assertEquals(0, number)
|
assertEquals(0, number)
|
||||||
assertEquals(getDate(2018, 9, 25, 7, 10, 0), start)
|
assertEquals(getDate(2018, 9, 25, 7, 10, 0), start)
|
||||||
|
@ -72,7 +80,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getSimpleLesson_replacementSameTeacher() {
|
fun getSimpleLesson_replacementSameTeacher() {
|
||||||
with(timetable[10]) {
|
with(timetable[WEDNESDAY_OFFSET]) {
|
||||||
// środa, 0
|
// środa, 0
|
||||||
assertEquals(0, number)
|
assertEquals(0, number)
|
||||||
assertEquals(getDate(2018, 9, 26, 7, 10, 0), start)
|
assertEquals(getDate(2018, 9, 26, 7, 10, 0), start)
|
||||||
|
@ -94,7 +102,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getSimpleLesson_replacementDifferentTeacher() {
|
fun getSimpleLesson_replacementDifferentTeacher() {
|
||||||
with(timetable[15]) {
|
with(timetable[THURSDAY_OFFSET]) {
|
||||||
// czwartek, 0
|
// czwartek, 0
|
||||||
assertEquals(0, number)
|
assertEquals(0, number)
|
||||||
assertEquals(getDate(2018, 9, 27, 7, 10, 0), start)
|
assertEquals(getDate(2018, 9, 27, 7, 10, 0), start)
|
||||||
|
@ -116,7 +124,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getGroupLesson() {
|
fun getGroupLesson() {
|
||||||
with(timetable[19]) {
|
with(timetable[FRIDAY_OFFSET]) {
|
||||||
// piątek, 0
|
// piątek, 0
|
||||||
assertEquals(0, number)
|
assertEquals(0, number)
|
||||||
assertEquals(getDate(2018, 9, 28, 7, 10, 0), start)
|
assertEquals(getDate(2018, 9, 28, 7, 10, 0), start)
|
||||||
|
@ -138,7 +146,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getGroupLesson_canceled() {
|
fun getGroupLesson_canceled() {
|
||||||
with(timetable[1]) {
|
with(timetable[MONDAY_OFFSET + 1]) {
|
||||||
// poniedziałek, 1
|
// poniedziałek, 1
|
||||||
assertEquals(1, number)
|
assertEquals(1, number)
|
||||||
assertEquals(getDate(2018, 9, 24, 8, 0, 0), start)
|
assertEquals(getDate(2018, 9, 24, 8, 0, 0), start)
|
||||||
|
@ -159,7 +167,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getGroupLesson_replacementSameTeacher() {
|
fun getGroupLesson_replacementSameTeacher() {
|
||||||
with(timetable[6]) {
|
with(timetable[TUESDAY_OFFSET + 1]) {
|
||||||
// wtorek, 1
|
// wtorek, 1
|
||||||
assertEquals(1, number)
|
assertEquals(1, number)
|
||||||
assertEquals(getDate(2018, 9, 25, 8, 0, 0), start)
|
assertEquals(getDate(2018, 9, 25, 8, 0, 0), start)
|
||||||
|
@ -180,7 +188,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getGroupLesson_replacementDifferentTeacher() {
|
fun getGroupLesson_replacementDifferentTeacher() {
|
||||||
with(timetable[11]) {
|
with(timetable[WEDNESDAY_OFFSET + 1]) {
|
||||||
// środa, 1
|
// środa, 1
|
||||||
assertEquals(1, number)
|
assertEquals(1, number)
|
||||||
assertEquals(getDate(2018, 9, 26, 8, 0, 0), start)
|
assertEquals(getDate(2018, 9, 26, 8, 0, 0), start)
|
||||||
|
@ -202,7 +210,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLesson_button() {
|
fun getLesson_button() {
|
||||||
with(timetable[16]) {
|
with(timetable[THURSDAY_OFFSET + 1]) {
|
||||||
// czwartek, 1
|
// czwartek, 1
|
||||||
assertEquals(1, number)
|
assertEquals(1, number)
|
||||||
assertEquals(getDate(2018, 9, 27, 8, 0, 0), start)
|
assertEquals(getDate(2018, 9, 27, 8, 0, 0), start)
|
||||||
|
@ -224,7 +232,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLesson_emptyOriginal() {
|
fun getLesson_emptyOriginal() {
|
||||||
with(timetable[20]) {
|
with(timetable[FRIDAY_OFFSET + 1]) {
|
||||||
// piątek, 1
|
// piątek, 1
|
||||||
assertEquals(1, number)
|
assertEquals(1, number)
|
||||||
assertEquals(getDate(2018, 9, 28, 8, 0, 0), start)
|
assertEquals(getDate(2018, 9, 28, 8, 0, 0), start)
|
||||||
|
@ -245,7 +253,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLesson() {
|
fun getLesson() {
|
||||||
with(timetable[2]) {
|
with(timetable[MONDAY_OFFSET + 2]) {
|
||||||
// poniedziałek, 2
|
// poniedziałek, 2
|
||||||
assertEquals(2, number)
|
assertEquals(2, number)
|
||||||
assertEquals(getDate(2018, 9, 24, 8, 50, 0), start)
|
assertEquals(getDate(2018, 9, 24, 8, 50, 0), start)
|
||||||
|
@ -266,7 +274,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLesson_invAndChange() {
|
fun getLesson_invAndChange() {
|
||||||
with(timetable[7]) {
|
with(timetable[TUESDAY_OFFSET + 2]) {
|
||||||
// wtorek, 2
|
// wtorek, 2
|
||||||
assertEquals(2, number)
|
assertEquals(2, number)
|
||||||
assertEquals(getDate(2018, 9, 25, 8, 50, 0), start)
|
assertEquals(getDate(2018, 9, 25, 8, 50, 0), start)
|
||||||
|
@ -287,7 +295,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getSimpleLesson_replacementDifferentTeacherv2() {
|
fun getSimpleLesson_replacementDifferentTeacherv2() {
|
||||||
with(timetable[12]) {
|
with(timetable[WEDNESDAY_OFFSET + 2]) {
|
||||||
// środa, 2
|
// środa, 2
|
||||||
assertEquals(2, number)
|
assertEquals(2, number)
|
||||||
assertEquals(getDate(2018, 9, 26, 8, 50, 0), start)
|
assertEquals(getDate(2018, 9, 26, 8, 50, 0), start)
|
||||||
|
@ -308,7 +316,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getSimpleLesson_movedWithButton() {
|
fun getSimpleLesson_movedWithButton() {
|
||||||
with(timetable[17]) {
|
with(timetable[THURSDAY_OFFSET + 2]) {
|
||||||
// czwartek, 2
|
// czwartek, 2
|
||||||
assertEquals(2, number)
|
assertEquals(2, number)
|
||||||
assertEquals(getDate(2018, 9, 27, 8, 50, 0), start)
|
assertEquals(getDate(2018, 9, 27, 8, 50, 0), start)
|
||||||
|
@ -329,7 +337,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getSimpleLesson_canceledWithoutReason() {
|
fun getSimpleLesson_canceledWithoutReason() {
|
||||||
with(timetable[21]) {
|
with(timetable[FRIDAY_OFFSET + 2]) {
|
||||||
// piątek, 2
|
// piątek, 2
|
||||||
assertEquals(2, number)
|
assertEquals(2, number)
|
||||||
assertEquals(getDate(2018, 9, 28, 8, 50, 0), start)
|
assertEquals(getDate(2018, 9, 28, 8, 50, 0), start)
|
||||||
|
@ -350,7 +358,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLesson_buttonWithChanges() {
|
fun getLesson_buttonWithChanges() {
|
||||||
with(timetable[3]) {
|
with(timetable[MONDAY_OFFSET + 3]) {
|
||||||
// poniedziałek, 3
|
// poniedziałek, 3
|
||||||
assertEquals(3, number)
|
assertEquals(3, number)
|
||||||
assertEquals(getDate(2018, 9, 24, 9, 45, 0), start)
|
assertEquals(getDate(2018, 9, 24, 9, 45, 0), start)
|
||||||
|
@ -372,7 +380,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLesson_buttonWithChanges2() {
|
fun getLesson_buttonWithChanges2() {
|
||||||
with(timetable[8]) {
|
with(timetable[TUESDAY_OFFSET + 3]) {
|
||||||
// wtorek, 3
|
// wtorek, 3
|
||||||
assertEquals(3, number)
|
assertEquals(3, number)
|
||||||
assertEquals(getDate(2018, 9, 25, 9, 45, 0), start)
|
assertEquals(getDate(2018, 9, 25, 9, 45, 0), start)
|
||||||
|
@ -394,7 +402,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLesson_tripleChange() {
|
fun getLesson_tripleChange() {
|
||||||
with(timetable[13]) {
|
with(timetable[WEDNESDAY_OFFSET + 3]) {
|
||||||
// środa 3
|
// środa 3
|
||||||
assertEquals(3, number)
|
assertEquals(3, number)
|
||||||
assertEquals(getDate(2018, 9, 26, 9, 45, 0), start)
|
assertEquals(getDate(2018, 9, 26, 9, 45, 0), start)
|
||||||
|
@ -416,7 +424,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLesson_tripleChange2() {
|
fun getLesson_tripleChange2() {
|
||||||
with(timetable[18]) {
|
with(timetable[THURSDAY_OFFSET + 3]) {
|
||||||
// czwartek, 3
|
// czwartek, 3
|
||||||
assertEquals(3, number)
|
assertEquals(3, number)
|
||||||
assertEquals(getDate(2018, 9, 27, 9, 45, 0), start)
|
assertEquals(getDate(2018, 9, 27, 9, 45, 0), start)
|
||||||
|
@ -438,7 +446,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLesson_two_change_lines_no_group() {
|
fun getLesson_two_change_lines_no_group() {
|
||||||
with(timetable[22]) {
|
with(timetable[FRIDAY_OFFSET + 3]) {
|
||||||
// piątek, 3
|
// piątek, 3
|
||||||
assertEquals(3, number)
|
assertEquals(3, number)
|
||||||
assertEquals(getDate(2018, 9, 28, 9, 45, 0), start)
|
assertEquals(getDate(2018, 9, 28, 9, 45, 0), start)
|
||||||
|
@ -460,7 +468,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getClasslessLesson_withoutChanges() {
|
fun getClasslessLesson_withoutChanges() {
|
||||||
with(timetable[4]) {
|
with(timetable[MONDAY_OFFSET + 4]) {
|
||||||
// poniedziałek, 4
|
// poniedziałek, 4
|
||||||
assertEquals(4, number)
|
assertEquals(4, number)
|
||||||
assertEquals(getDate(2018, 9, 24, 10, 50, 0), start)
|
assertEquals(getDate(2018, 9, 24, 10, 50, 0), start)
|
||||||
|
@ -482,7 +490,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getLightLesson_withChanges() {
|
fun getLightLesson_withChanges() {
|
||||||
with(timetable[9]) {
|
with(timetable[TUESDAY_OFFSET + 4]) {
|
||||||
// wtorek, 4
|
// wtorek, 4
|
||||||
assertEquals(4, number)
|
assertEquals(4, number)
|
||||||
assertEquals(getDate(2018, 9, 25, 10, 50, 0), start)
|
assertEquals(getDate(2018, 9, 25, 10, 50, 0), start)
|
||||||
|
@ -504,7 +512,7 @@ class TimetableTest : BaseLocalTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun getClasslessLesson_groupWithChanges() {
|
fun getClasslessLesson_groupWithChanges() {
|
||||||
with(timetable[14]) {
|
with(timetable[WEDNESDAY_OFFSET + 4]) {
|
||||||
// środa, 4
|
// środa, 4
|
||||||
assertEquals(4, number)
|
assertEquals(4, number)
|
||||||
assertEquals(getDate(2018, 9, 26, 10, 50, 0), start)
|
assertEquals(getDate(2018, 9, 26, 10, 50, 0), start)
|
||||||
|
|
Loading…
Reference in a new issue