diff --git a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/ObservationDatabaseApplicationTests.kt b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/ObservationDatabaseApplicationTests.kt index c6a0dad..56badab 100644 --- a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/ObservationDatabaseApplicationTests.kt +++ b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/ObservationDatabaseApplicationTests.kt @@ -1,5 +1,6 @@ package uk.co.neviyn.observationdatabase +import junit.framework.TestCase.assertFalse import junit.framework.TestCase.assertNotNull import org.junit.Test import org.junit.runner.RunWith @@ -22,5 +23,6 @@ class ObservationDatabaseApplicationTests { fun contextLoads() { assertNotNull(observationsController) assertNotNull(groupSessionController) + assertFalse(GroupSessionManager.isValid()) } } diff --git a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/controller/GroupSessionControllerTest.kt b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/controller/GroupSessionControllerTest.kt index ab9a876..9153ab9 100644 --- a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/controller/GroupSessionControllerTest.kt +++ b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/controller/GroupSessionControllerTest.kt @@ -137,4 +137,17 @@ class GroupSessionControllerTest { val rc = RatingComponent(rating = 5) controller.addGroupObservation(GroupObservation("A Student", listOf(Scenario(0, "Different Title", rc, rc, rc, rc, rc, rc, rc, rc)))) } + + @Test + fun testSubmit_PartialData() { + val site = Site(1, "Test site") + Mockito.doReturn(Optional.of(site)).`when`(siteRepository).findById(1) + Mockito.doReturn(listOf(Tutor(1, "Mr X", site))).`when`(tutorRepository).findAllById(listOf(1)) + controller.startGroupObservation(GroupObservationInit(1, TrainingType.INITIAL, listOf(1), listOf("Sample title"))) + val rc = RatingComponent(rating = 5) + controller.addGroupObservation(GroupObservation("A Student", listOf(Scenario(0, "Sample title", RatingComponent(rating = 0), rc, rc, rc, rc, rc, rc, rc)))) + assertEquals(1, GroupSessionManager.observations.size) + assertEquals("A Student", GroupSessionManager.observations.keys.first()) + assertEquals("A Student", GroupSessionManager.observations.values.first().person) + } } \ No newline at end of file