Add teachers test
This commit is contained in:
parent
088ac7405e
commit
7df56aa8bb
4 changed files with 176 additions and 1 deletions
|
@ -84,7 +84,8 @@ class StudentAndParentRepository(private val api: StudentAndParentService) {
|
|||
return api.getSchoolAndTeachers().map {
|
||||
it.subjects.flatMap { subject ->
|
||||
subject.teachers.split(", ").map { teacher ->
|
||||
Teacher(teacher, subject.name)
|
||||
val tas = teacher.split(" [")
|
||||
Teacher(tas.first(), tas.last().removeSuffix("]"), subject.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@ package io.github.wulkanowy.api.school
|
|||
|
||||
data class Teacher(
|
||||
val name: String,
|
||||
val short: String,
|
||||
val subject: String
|
||||
)
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package io.github.wulkanowy.api.school
|
||||
|
||||
import io.github.wulkanowy.api.BaseTest
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class TeachersTest : BaseTest() {
|
||||
|
||||
private val teachers by lazy {
|
||||
getSnpRepo(TeachersTest::class.java, "Szkola.html").getTeachers().blockingGet()
|
||||
}
|
||||
|
||||
@Test fun getTeachersSizeTest() {
|
||||
assertEquals(21, teachers.size)
|
||||
}
|
||||
|
||||
@Test fun getSubjectTest() {
|
||||
assertEquals("Biologia", teachers[0].subject)
|
||||
}
|
||||
|
||||
@Test fun getSubjectFromManyTeachersTest() {
|
||||
assertEquals("Język angielski", teachers[6].subject)
|
||||
assertEquals("Język angielski", teachers[7].subject)
|
||||
}
|
||||
|
||||
@Test fun getTeacherNameTest() {
|
||||
assertEquals("Karolina Kowalska", teachers[0].name)
|
||||
assertEquals("Karolina Kowalska", teachers[6].name)
|
||||
assertEquals("Mateusz Kowal", teachers[7].name)
|
||||
}
|
||||
|
||||
@Test fun getTeacherShortTest() {
|
||||
assertEquals("AN", teachers[0].short)
|
||||
assertEquals("AN", teachers[6].short)
|
||||
assertEquals("MK", teachers[7].short)
|
||||
}
|
||||
}
|
136
src/test/resources/io/github/wulkanowy/api/school/Szkola.html
Normal file
136
src/test/resources/io/github/wulkanowy/api/school/Szkola.html
Normal file
|
@ -0,0 +1,136 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Witryna ucznia i rodzica – Szkoła i nauczyciele</title>
|
||||
</head>
|
||||
<body>
|
||||
<main class="mainContainer">
|
||||
<h1>Szkoła</h1>
|
||||
<article>
|
||||
<div class="daneWiersz">
|
||||
<span class="tytul">Nazwa szkoły:</span>
|
||||
<span class="wartosc">Zespół Szkół nr 64</span>
|
||||
</div>
|
||||
<div class="daneWiersz">
|
||||
<span class="tytul">Adres szkoły:</span>
|
||||
<span class="wartosc">ul. Wiśniowa 128, 01-234 Rogalowo, Nibylandia</span>
|
||||
</div>
|
||||
<div class="daneWiersz">
|
||||
<span class="tytul">Telefon:</span>
|
||||
<span class="wartosc">55 5555555</span>
|
||||
</div>
|
||||
<div class="daneWiersz">
|
||||
<span class="tytul">Imię i nazwisko dyrektora:</span>
|
||||
<span class="wartosc">Antoni Sobczyk</span>
|
||||
</div>
|
||||
<div class="daneWiersz">
|
||||
<span class="tytul">Imię i nazwisko pedagoga:</span>
|
||||
<span class="wartosc">Zofia Czerwińska [ZC], Aleksander Krzemiński [AK], Karolina Kowalska [KK], Bartek Dąbrowski [BD]</span>
|
||||
</div>
|
||||
</article>
|
||||
<h1>Nauczyciele</h1>
|
||||
<p>
|
||||
Klasa: 1a, Wychowawcy:
|
||||
Karolina Kowalska [AN], Antoni Sobczyk [AS]</p>
|
||||
<br/>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="title">
|
||||
<th>Lp.</th>
|
||||
<th>Przedmiot</th>
|
||||
<th>Nauczyciel</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>Biologia</td>
|
||||
<td>Karolina Kowalska [AN]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td>Chemia</td>
|
||||
<td>Zofia Czerwińska [NA]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td>Edukacja dla bezpieczeństwa</td>
|
||||
<td>Aleksandra Krajewska [AK]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4</td>
|
||||
<td>Fizyka</td>
|
||||
<td>Stanisław Krupa [BS]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>5</td>
|
||||
<td>Geografia</td>
|
||||
<td>Aleksandra Wójtowicz [AW]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6</td>
|
||||
<td>Historia</td>
|
||||
<td>Sara Wierzbicka [KB]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>7</td>
|
||||
<td>Język angielski</td>
|
||||
<td>Karolina Kowalska [AN], Mateusz Kowal [MK], Amelia Mazur [AM]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8</td>
|
||||
<td>Język niemiecki</td>
|
||||
<td>Mateusz Kowal [MK], Barbara Markowska [BM]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>9</td>
|
||||
<td>Język polski</td>
|
||||
<td>Michał Mazur [MM]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>10</td>
|
||||
<td>Matematyka</td>
|
||||
<td>Szymon Wojciechowski [SW]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11</td>
|
||||
<td>Plastyka</td>
|
||||
<td>Michał Mazur [MM]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>12</td>
|
||||
<td>Religia</td>
|
||||
<td>Maja Wiśniewska [M]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>13</td>
|
||||
<td>Wiedza o społeczeństwie</td>
|
||||
<td>Karolina Kowalska [AN]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>14</td>
|
||||
<td>Wychowanie do życia w rodzinie</td>
|
||||
<td>Zofia Czerwińska [NA]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>15</td>
|
||||
<td>Wychowanie fizyczne</td>
|
||||
<td>Karolina Kowalska [AN], Liliana Kowal [LK]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>16</td>
|
||||
<td>Zajęcia techniczne</td>
|
||||
<td>Bartek Dąbrowski [BD]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>17</td>
|
||||
<td>Zajęcia z wychowawcą</td>
|
||||
<td>Karolina Kowalska [AN]</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
<footer>wersja: 17.02.0000.23328</footer>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue