Formatting.
This commit is contained in:
parent
563bbd17da
commit
4cba15acb3
@ -24,25 +24,39 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFindBySiteAndDateBetween_EmptyRepository() {
|
fun testFindBySiteAndDateBetween_EmptyRepository() {
|
||||||
val result = observationRepository.findBySiteAndDateBetween(Site(1, "x"), LocalDate.now(), LocalDate.now())
|
val result = observationRepository.findBySiteAndDateBetween(Site(
|
||||||
|
id = 1,
|
||||||
|
name = "x"
|
||||||
|
), LocalDate.now(), LocalDate.now())
|
||||||
assertTrue(result.isEmpty())
|
assertTrue(result.isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFindBySiteAndWhomAndDateBetween_EmptyRepository() {
|
fun testFindBySiteAndWhomAndDateBetween_EmptyRepository() {
|
||||||
val result = observationRepository.findBySiteAndWhomAndDateBetween(Site(1, "x"), "none", LocalDate.now(), LocalDate.now())
|
val result = observationRepository.findBySiteAndWhomAndDateBetween(Site(
|
||||||
|
id = 1,
|
||||||
|
name = "x"
|
||||||
|
), "none", LocalDate.now(), LocalDate.now())
|
||||||
assertTrue(result.isEmpty())
|
assertTrue(result.isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFindByTutorsAndDateBetween_EmptyRepository() {
|
fun testFindByTutorsAndDateBetween_EmptyRepository() {
|
||||||
val result = observationRepository.findByTutorsAndDateBetween(Tutor(1, "x", Site(1, "x")), LocalDate.now(), LocalDate.now())
|
val result = observationRepository.findByTutorsAndDateBetween(Tutor(
|
||||||
|
id = 1,
|
||||||
|
name = "x",
|
||||||
|
site = Site(1, "x")
|
||||||
|
), LocalDate.now(), LocalDate.now())
|
||||||
assertTrue(result.isEmpty())
|
assertTrue(result.isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFindByTutorsAndWhomAndDateBetween_EmptyRepository() {
|
fun testFindByTutorsAndWhomAndDateBetween_EmptyRepository() {
|
||||||
val result = observationRepository.findByTutorsAndWhomAndDateBetween(Tutor(1, "x", Site(1, "x")), "none", LocalDate.now(), LocalDate.now())
|
val result = observationRepository.findByTutorsAndWhomAndDateBetween(Tutor(
|
||||||
|
id = 1,
|
||||||
|
name = "x",
|
||||||
|
site = Site(1, "x")
|
||||||
|
), "none", LocalDate.now(), LocalDate.now())
|
||||||
assertTrue(result.isEmpty())
|
assertTrue(result.isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,27 +67,87 @@ class RepositoryTest {
|
|||||||
val incorrectSite = entityManager.persist(Site(name = "Incorrect"))
|
val incorrectSite = entityManager.persist(Site(name = "Incorrect"))
|
||||||
val tutor = entityManager.persist(Tutor(name = "X", site = correctSite))
|
val tutor = entityManager.persist(Tutor(name = "X", site = correctSite))
|
||||||
val tutor2 = entityManager.persist(Tutor(name = "N", site = incorrectSite))
|
val tutor2 = entityManager.persist(Tutor(name = "N", site = incorrectSite))
|
||||||
val tooEarly = Observation(site = correctSite, date = LocalDate.now().minusDays(5),
|
val tooEarly = Observation(
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
site = correctSite,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
date = LocalDate.now().minusDays(5),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
type = TrainingType.INITIAL,
|
||||||
val tooLate = Observation(site = correctSite, date = LocalDate.now().plusDays(5),
|
observed = "1",
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
whom = "G1",
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
monitoring = 5.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
controlProcedural = 3.0,
|
||||||
val wrongSite = Observation(site = incorrectSite, date = LocalDate.now(),
|
control = 4.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
conservatism = 3.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
teamworkCommunications = 2.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor2), persons = setOf(person))
|
teamworkLeadership = 3.0,
|
||||||
val justRight = Observation(site = correctSite, date = LocalDate.now(),
|
teamworkWorkload = 1.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
knowledge = 1.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
entries = listOf(),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val tooLate = Observation(
|
||||||
|
site = correctSite,
|
||||||
|
date = LocalDate.now().plusDays(5),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val wrongSite = Observation(
|
||||||
|
site = incorrectSite,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor2),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val justRight = Observation(
|
||||||
|
site = correctSite,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
entityManager.persist(tooEarly)
|
entityManager.persist(tooEarly)
|
||||||
entityManager.persist(tooLate)
|
entityManager.persist(tooLate)
|
||||||
entityManager.persist(wrongSite)
|
entityManager.persist(wrongSite)
|
||||||
entityManager.persist(justRight)
|
entityManager.persist(justRight)
|
||||||
val result = observationRepository.findBySiteAndDateBetween(site = correctSite, startDate = LocalDate.now().minusDays(1), endDate = LocalDate.now().plusDays(1))
|
val result = observationRepository.findBySiteAndDateBetween(
|
||||||
|
site = correctSite,
|
||||||
|
startDate = LocalDate.now().minusDays(1),
|
||||||
|
endDate = LocalDate.now().plusDays(1)
|
||||||
|
)
|
||||||
assertEquals(1, result.size)
|
assertEquals(1, result.size)
|
||||||
assertEquals(justRight, result.first())
|
assertEquals(justRight, result.first())
|
||||||
}
|
}
|
||||||
@ -85,32 +159,107 @@ class RepositoryTest {
|
|||||||
val person = entityManager.persist(Person(name = "Foo Bar"))
|
val person = entityManager.persist(Person(name = "Foo Bar"))
|
||||||
val tutor = entityManager.persist(Tutor(name = "X", site = correctSite))
|
val tutor = entityManager.persist(Tutor(name = "X", site = correctSite))
|
||||||
val tutor2 = entityManager.persist(Tutor(name = "N", site = incorrectSite))
|
val tutor2 = entityManager.persist(Tutor(name = "N", site = incorrectSite))
|
||||||
val tooEarly = Observation(site = correctSite, date = LocalDate.now().minusDays(5),
|
val tooEarly = Observation(
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
site = correctSite,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
date = LocalDate.now().minusDays(5),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
type = TrainingType.INITIAL,
|
||||||
val tooLate = Observation(site = correctSite, date = LocalDate.now().plusDays(5),
|
observed = "1",
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
whom = "G1",
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
monitoring = 5.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
controlProcedural = 3.0,
|
||||||
val wrongSite = Observation(site = incorrectSite, date = LocalDate.now(),
|
control = 4.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
conservatism = 3.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
teamworkCommunications = 2.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor2), persons = setOf(person))
|
teamworkLeadership = 3.0,
|
||||||
val justRight = Observation(site = correctSite, date = LocalDate.now(),
|
teamworkWorkload = 1.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
knowledge = 1.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
entries = listOf(),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
tutors = setOf(tutor),
|
||||||
val wrongWhom = Observation(site = correctSite, date = LocalDate.now(),
|
persons = setOf(person)
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G2", monitoring = 5.0, controlProcedural = 3.0,
|
)
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
val tooLate = Observation(
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
site = correctSite,
|
||||||
|
date = LocalDate.now().plusDays(5),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val wrongSite = Observation(
|
||||||
|
site = incorrectSite,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor2),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val justRight = Observation(
|
||||||
|
site = correctSite,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val wrongWhom = Observation(
|
||||||
|
site = correctSite,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G2",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
entityManager.persist(tooEarly)
|
entityManager.persist(tooEarly)
|
||||||
entityManager.persist(tooLate)
|
entityManager.persist(tooLate)
|
||||||
entityManager.persist(wrongSite)
|
entityManager.persist(wrongSite)
|
||||||
entityManager.persist(justRight)
|
entityManager.persist(justRight)
|
||||||
entityManager.persist(wrongWhom)
|
entityManager.persist(wrongWhom)
|
||||||
val result = observationRepository.findBySiteAndWhomAndDateBetween(site = correctSite, startDate = LocalDate.now().minusDays(1), endDate = LocalDate.now().plusDays(1), whom = "G1")
|
val result = observationRepository.findBySiteAndWhomAndDateBetween(
|
||||||
|
site = correctSite,
|
||||||
|
startDate = LocalDate.now().minusDays(1),
|
||||||
|
endDate = LocalDate.now().plusDays(1),
|
||||||
|
whom = "G1"
|
||||||
|
)
|
||||||
assertEquals(1, result.size)
|
assertEquals(1, result.size)
|
||||||
assertEquals(justRight, result.first())
|
assertEquals(justRight, result.first())
|
||||||
}
|
}
|
||||||
@ -121,26 +270,96 @@ class RepositoryTest {
|
|||||||
val person = entityManager.persist(Person(name = "Foo Bar"))
|
val person = entityManager.persist(Person(name = "Foo Bar"))
|
||||||
val correctTutor = entityManager.persist(Tutor(name = "X", site = site))
|
val correctTutor = entityManager.persist(Tutor(name = "X", site = site))
|
||||||
val incorrectTutor = entityManager.persist(Tutor(name = "N", site = site))
|
val incorrectTutor = entityManager.persist(Tutor(name = "N", site = site))
|
||||||
val tooEarly = Observation(site = site, date = LocalDate.now().minusDays(5),
|
val tooEarly = Observation(
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
site = site,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
date = LocalDate.now().minusDays(5),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor), persons = setOf(person))
|
type = TrainingType.INITIAL,
|
||||||
val tooLate = Observation(site = site, date = LocalDate.now().plusDays(5),
|
observed = "1",
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
whom = "G1",
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
monitoring = 5.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor), persons = setOf(person))
|
controlProcedural = 3.0,
|
||||||
val wrongTutor = Observation(site = site, date = LocalDate.now(),
|
control = 4.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
conservatism = 3.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
teamworkCommunications = 2.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(incorrectTutor), persons = setOf(person))
|
teamworkLeadership = 3.0,
|
||||||
val justRight = Observation(site = site, date = LocalDate.now(),
|
teamworkWorkload = 1.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
knowledge = 1.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
entries = listOf(),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor), persons = setOf(person))
|
tutors = setOf(correctTutor),
|
||||||
val justRightMultipleTutors = Observation(site = site, date = LocalDate.now(),
|
persons = setOf(person)
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
)
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
val tooLate = Observation(
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor, incorrectTutor), persons = setOf(person))
|
site = site,
|
||||||
|
date = LocalDate.now().plusDays(5),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(correctTutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val wrongTutor = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(incorrectTutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val justRight = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(correctTutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val justRightMultipleTutors = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(correctTutor, incorrectTutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
entityManager.persist(tooEarly)
|
entityManager.persist(tooEarly)
|
||||||
entityManager.persist(tooLate)
|
entityManager.persist(tooLate)
|
||||||
entityManager.persist(wrongTutor)
|
entityManager.persist(wrongTutor)
|
||||||
@ -150,7 +369,11 @@ class RepositoryTest {
|
|||||||
entityManager.persist(correctTutor)
|
entityManager.persist(correctTutor)
|
||||||
incorrectTutor.observations.addAll(listOf(wrongTutor, justRightMultipleTutors))
|
incorrectTutor.observations.addAll(listOf(wrongTutor, justRightMultipleTutors))
|
||||||
entityManager.persist(incorrectTutor)
|
entityManager.persist(incorrectTutor)
|
||||||
val result = observationRepository.findByTutorsAndDateBetween(tutor = correctTutor, startDate = LocalDate.now().minusDays(1), endDate = LocalDate.now().plusDays(1))
|
val result = observationRepository.findByTutorsAndDateBetween(
|
||||||
|
tutor = correctTutor,
|
||||||
|
startDate = LocalDate.now().minusDays(1),
|
||||||
|
endDate = LocalDate.now().plusDays(1)
|
||||||
|
)
|
||||||
assertEquals(2, result.size)
|
assertEquals(2, result.size)
|
||||||
assertTrue(result.contains(justRight))
|
assertTrue(result.contains(justRight))
|
||||||
assertTrue(result.contains(justRightMultipleTutors))
|
assertTrue(result.contains(justRightMultipleTutors))
|
||||||
@ -163,30 +386,114 @@ class RepositoryTest {
|
|||||||
val person = entityManager.persist(Person(name = "Foo Bar"))
|
val person = entityManager.persist(Person(name = "Foo Bar"))
|
||||||
val correctTutor = entityManager.persist(Tutor(name = "X", site = site))
|
val correctTutor = entityManager.persist(Tutor(name = "X", site = site))
|
||||||
val incorrectTutor = entityManager.persist(Tutor(name = "N", site = site))
|
val incorrectTutor = entityManager.persist(Tutor(name = "N", site = site))
|
||||||
val tooEarly = Observation(site = site, date = LocalDate.now().minusDays(5),
|
val tooEarly = Observation(
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
site = site,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
date = LocalDate.now().minusDays(5),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor), persons = setOf(person))
|
type = TrainingType.INITIAL,
|
||||||
val tooLate = Observation(site = site, date = LocalDate.now().plusDays(5),
|
observed = "1",
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
whom = "G1",
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
monitoring = 5.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor), persons = setOf(person))
|
controlProcedural = 3.0,
|
||||||
val wrongTutor = Observation(site = site, date = LocalDate.now(),
|
control = 4.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
conservatism = 3.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
teamworkCommunications = 2.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(incorrectTutor), persons = setOf(person))
|
teamworkLeadership = 3.0,
|
||||||
val justRight = Observation(site = site, date = LocalDate.now(),
|
teamworkWorkload = 1.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
knowledge = 1.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
entries = listOf(),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor), persons = setOf(person))
|
tutors = setOf(correctTutor),
|
||||||
val wrongGroup = Observation(site = site, date = LocalDate.now(),
|
persons = setOf(person)
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G2", monitoring = 5.0, controlProcedural = 3.0,
|
)
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
val tooLate = Observation(
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor), persons = setOf(person))
|
site = site,
|
||||||
val justRightMultipleTutors = Observation(site = site, date = LocalDate.now(),
|
date = LocalDate.now().plusDays(5),
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
type = TrainingType.INITIAL,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
observed = "1",
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor, incorrectTutor), persons = setOf(person))
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(correctTutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val wrongTutor = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(incorrectTutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val justRight = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(correctTutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val wrongGroup = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G2",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(correctTutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val justRightMultipleTutors = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(correctTutor, incorrectTutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
entityManager.persist(tooEarly)
|
entityManager.persist(tooEarly)
|
||||||
entityManager.persist(tooLate)
|
entityManager.persist(tooLate)
|
||||||
entityManager.persist(wrongTutor)
|
entityManager.persist(wrongTutor)
|
||||||
@ -197,7 +504,12 @@ class RepositoryTest {
|
|||||||
entityManager.persist(correctTutor)
|
entityManager.persist(correctTutor)
|
||||||
incorrectTutor.observations.addAll(listOf(wrongTutor, justRightMultipleTutors))
|
incorrectTutor.observations.addAll(listOf(wrongTutor, justRightMultipleTutors))
|
||||||
entityManager.persist(incorrectTutor)
|
entityManager.persist(incorrectTutor)
|
||||||
val result = observationRepository.findByTutorsAndWhomAndDateBetween(tutor = correctTutor, startDate = LocalDate.now().minusDays(1), endDate = LocalDate.now().plusDays(1), whom = "G1")
|
val result = observationRepository.findByTutorsAndWhomAndDateBetween(
|
||||||
|
tutor = correctTutor,
|
||||||
|
startDate = LocalDate.now().minusDays(1),
|
||||||
|
endDate = LocalDate.now().plusDays(1),
|
||||||
|
whom = "G1"
|
||||||
|
)
|
||||||
assertEquals(2, result.size)
|
assertEquals(2, result.size)
|
||||||
assertTrue(result.contains(justRight))
|
assertTrue(result.contains(justRight))
|
||||||
assertTrue(result.contains(justRightMultipleTutors))
|
assertTrue(result.contains(justRightMultipleTutors))
|
||||||
@ -211,27 +523,88 @@ class RepositoryTest {
|
|||||||
val otherPerson = entityManager.persist(Person(name = "Wrong"))
|
val otherPerson = entityManager.persist(Person(name = "Wrong"))
|
||||||
val site = entityManager.persist(Site(name = "Incorrect"))
|
val site = entityManager.persist(Site(name = "Incorrect"))
|
||||||
val tutor = entityManager.persist(Tutor(name = "X", site = site))
|
val tutor = entityManager.persist(Tutor(name = "X", site = site))
|
||||||
val tooEarly = Observation(site = site, date = LocalDate.now().minusDays(5),
|
val tooEarly = Observation(
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
site = site,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
date = LocalDate.now().minusDays(5),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
type = TrainingType.INITIAL,
|
||||||
val tooLate = Observation(site = site, date = LocalDate.now().plusDays(5),
|
observed = "1",
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
whom = "G1",
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
monitoring = 5.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
controlProcedural = 3.0,
|
||||||
val wrongPerson = Observation(site = site, date = LocalDate.now(),
|
control = 4.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
conservatism = 3.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
teamworkCommunications = 2.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(otherPerson))
|
teamworkLeadership = 3.0,
|
||||||
val justRight = Observation(site = site, date = LocalDate.now(),
|
teamworkWorkload = 1.0,
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
knowledge = 1.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
entries = listOf(),
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor), persons = setOf(person))
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val tooLate = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now().plusDays(5),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
|
val wrongPerson = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(otherPerson)
|
||||||
|
)
|
||||||
|
val justRight = Observation(
|
||||||
|
site = site,
|
||||||
|
date = LocalDate.now(),
|
||||||
|
type = TrainingType.INITIAL,
|
||||||
|
observed = "1",
|
||||||
|
whom = "G1",
|
||||||
|
monitoring = 5.0,
|
||||||
|
controlProcedural = 3.0,
|
||||||
|
control = 4.0,
|
||||||
|
conservatism = 3.0,
|
||||||
|
teamworkCommunications = 2.0,
|
||||||
|
teamworkLeadership = 3.0,
|
||||||
|
teamworkWorkload = 1.0,
|
||||||
|
knowledge = 1.0,
|
||||||
|
entries = listOf(),
|
||||||
|
tutors = setOf(tutor),
|
||||||
|
persons = setOf(person)
|
||||||
|
)
|
||||||
entityManager.persist(tooEarly)
|
entityManager.persist(tooEarly)
|
||||||
entityManager.persist(tooLate)
|
entityManager.persist(tooLate)
|
||||||
entityManager.persist(wrongPerson)
|
entityManager.persist(wrongPerson)
|
||||||
entityManager.persist(justRight)
|
entityManager.persist(justRight)
|
||||||
val result = observationRepository.findBySiteAndPersonsAndDateBetween(site = site, person = person, startDate = LocalDate.now().minusDays(1), endDate = LocalDate.now().plusDays(1))
|
val result = observationRepository.findBySiteAndPersonsAndDateBetween(
|
||||||
|
site = site,
|
||||||
|
person = person,
|
||||||
|
startDate = LocalDate.now().minusDays(1),
|
||||||
|
endDate = LocalDate.now().plusDays(1)
|
||||||
|
)
|
||||||
assertEquals(1, result.size)
|
assertEquals(1, result.size)
|
||||||
assertEquals(justRight, result.first())
|
assertEquals(justRight, result.first())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user