Fixed testAddObservation
This commit is contained in:
parent
d8b3c0040d
commit
3ebaf66a33
@ -89,20 +89,21 @@ class ControllerTest {
|
||||
assertEquals(NameValue("Foo", 1), result)
|
||||
}
|
||||
|
||||
/** TODO: Fix this test
|
||||
@Test
|
||||
fun testAddObservation() {
|
||||
val site = Site(1, "X")
|
||||
val tutor = Tutor(1, "Foo Bar", site)
|
||||
val person = Person(name = "Mr X")
|
||||
doReturn(Optional.of(site)).`when`(siteRepository).findById(1)
|
||||
doReturn(listOf(tutor)).`when`(tutorRepository).findAllById(listOf(1))
|
||||
val newData = NewObservation(1, TrainingType.INITIAL, "An Observation", "Group A", listOf(Entry(RatingCategory.MONITORING, 5, "", "")), listOf(1), listOf())
|
||||
val observation = Observation(1, site, LocalDate.now(), TrainingType.INITIAL, "An Observation", "Group A", 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, newData.scenarios, setOf(tutor), setOf())
|
||||
doReturn(person).`when`(personRepository).findFirstByNameLike("MR X")
|
||||
val defaultComponent = RatingComponent(rating = 5, strengths = "", improvements = "")
|
||||
val newData = NewObservation(1, TrainingType.INITIAL, "An Observation", listOf(Scenario(title = "Something", monitoring = defaultComponent, controlProcedural = defaultComponent, control = defaultComponent, conservatism = defaultComponent, teamworkCommunications = defaultComponent, teamworkLeadership = defaultComponent, teamworkWorkload = defaultComponent, knowledge = defaultComponent)), listOf(1), "Mr X")
|
||||
val observation = Observation(1, site, LocalDate.now(), TrainingType.INITIAL, "An Observation", 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, newData.scenarios, setOf(tutor), person)
|
||||
doReturn(observation).`when`(observationRepository).save(ArgumentMatchers.any())
|
||||
val result = controller.addObservation(newData)
|
||||
assertEquals(1L, result)
|
||||
}
|
||||
**/
|
||||
|
||||
@Test
|
||||
fun testGetObservations_SiteAndTutorNull() {
|
||||
|
Loading…
Reference in New Issue
Block a user