Formatting.
This commit is contained in:
parent
563bbd17da
commit
4cba15acb3
@ -24,25 +24,39 @@ class RepositoryTest {
|
||||
|
||||
@Test
|
||||
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())
|
||||
}
|
||||
|
||||
@Test
|
||||
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())
|
||||
}
|
||||
|
||||
@Test
|
||||
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())
|
||||
}
|
||||
|
||||
@Test
|
||||
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())
|
||||
}
|
||||
|
||||
@ -53,27 +67,87 @@ class RepositoryTest {
|
||||
val incorrectSite = entityManager.persist(Site(name = "Incorrect"))
|
||||
val tutor = entityManager.persist(Tutor(name = "X", site = correctSite))
|
||||
val tutor2 = entityManager.persist(Tutor(name = "N", site = incorrectSite))
|
||||
val tooEarly = Observation(site = correctSite, date = LocalDate.now().minusDays(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 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))
|
||||
val tooEarly = Observation(
|
||||
site = correctSite,
|
||||
date = LocalDate.now().minusDays(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 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(tooLate)
|
||||
entityManager.persist(wrongSite)
|
||||
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(justRight, result.first())
|
||||
}
|
||||
@ -85,32 +159,107 @@ class RepositoryTest {
|
||||
val person = entityManager.persist(Person(name = "Foo Bar"))
|
||||
val tutor = entityManager.persist(Tutor(name = "X", site = correctSite))
|
||||
val tutor2 = entityManager.persist(Tutor(name = "N", site = incorrectSite))
|
||||
val tooEarly = Observation(site = correctSite, date = LocalDate.now().minusDays(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 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))
|
||||
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))
|
||||
val tooEarly = Observation(
|
||||
site = correctSite,
|
||||
date = LocalDate.now().minusDays(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 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)
|
||||
)
|
||||
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(tooLate)
|
||||
entityManager.persist(wrongSite)
|
||||
entityManager.persist(justRight)
|
||||
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(justRight, result.first())
|
||||
}
|
||||
@ -121,26 +270,96 @@ class RepositoryTest {
|
||||
val person = entityManager.persist(Person(name = "Foo Bar"))
|
||||
val correctTutor = entityManager.persist(Tutor(name = "X", site = site))
|
||||
val incorrectTutor = entityManager.persist(Tutor(name = "N", site = site))
|
||||
val tooEarly = Observation(site = site, date = LocalDate.now().minusDays(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 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(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))
|
||||
val tooEarly = Observation(
|
||||
site = site,
|
||||
date = LocalDate.now().minusDays(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 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(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(tooLate)
|
||||
entityManager.persist(wrongTutor)
|
||||
@ -150,7 +369,11 @@ class RepositoryTest {
|
||||
entityManager.persist(correctTutor)
|
||||
incorrectTutor.observations.addAll(listOf(wrongTutor, justRightMultipleTutors))
|
||||
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)
|
||||
assertTrue(result.contains(justRight))
|
||||
assertTrue(result.contains(justRightMultipleTutors))
|
||||
@ -163,30 +386,114 @@ class RepositoryTest {
|
||||
val person = entityManager.persist(Person(name = "Foo Bar"))
|
||||
val correctTutor = entityManager.persist(Tutor(name = "X", site = site))
|
||||
val incorrectTutor = entityManager.persist(Tutor(name = "N", site = site))
|
||||
val tooEarly = Observation(site = site, date = LocalDate.now().minusDays(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 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(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))
|
||||
val tooEarly = Observation(
|
||||
site = site,
|
||||
date = LocalDate.now().minusDays(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 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(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(tooLate)
|
||||
entityManager.persist(wrongTutor)
|
||||
@ -197,7 +504,12 @@ class RepositoryTest {
|
||||
entityManager.persist(correctTutor)
|
||||
incorrectTutor.observations.addAll(listOf(wrongTutor, justRightMultipleTutors))
|
||||
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)
|
||||
assertTrue(result.contains(justRight))
|
||||
assertTrue(result.contains(justRightMultipleTutors))
|
||||
@ -211,27 +523,88 @@ class RepositoryTest {
|
||||
val otherPerson = entityManager.persist(Person(name = "Wrong"))
|
||||
val site = entityManager.persist(Site(name = "Incorrect"))
|
||||
val tutor = entityManager.persist(Tutor(name = "X", site = site))
|
||||
val tooEarly = Observation(site = site, date = LocalDate.now().minusDays(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 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))
|
||||
val tooEarly = Observation(
|
||||
site = site,
|
||||
date = LocalDate.now().minusDays(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 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(tooLate)
|
||||
entityManager.persist(wrongPerson)
|
||||
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(justRight, result.first())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user