From aba1b91eec73a1f17e7a8df522c7a3f0173f4edc Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Wed, 26 Feb 2020 14:24:01 +0000 Subject: [PATCH] Increased testing on long strings in scenario submissions --- .../observationdatabase/RepositoryTest.kt | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/RepositoryTest.kt b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/RepositoryTest.kt index 8b60795..a6ab27c 100644 --- a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/RepositoryTest.kt +++ b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/RepositoryTest.kt @@ -332,12 +332,26 @@ class RepositoryTest { val site = entityManager.persist(Site(name = "X")) val tutor = entityManager.persist(Tutor(name = "Foo Bar", site = site)) val person = "Mr X" - val testString = "teststring".repeat(100) - val scenario = entityManager.persist(Scenario(0, "Something", 5, testString, "", 5, "", "", 5, "", "", 5, "", "", 5, "", "", 5, "", "", 5, "", "", 5, "", "")) + val testString = "teststring".repeat(500) + val scenario = entityManager.persist(Scenario(0, "Something", 5, testString, testString, 5, testString, testString, 5, testString, testString, 5, testString, testString, 5, testString, testString, 5, testString, testString, 5, testString, testString, 5, testString, testString)) val scenarios = listOf(scenario) val observation = Observation(0, site, LocalDate.now(), TrainingType.INITIAL, "An Observation", 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, scenarios, setOf(tutor), person) val result = entityManager.persist(observation) - assertEquals(1, result.id) - assertEquals(testString, observation.scenarios.first().monitoringStrengths) + assertEquals(testString, result.scenarios.first().monitoringStrengths) + assertEquals(testString, result.scenarios.first().monitoringImprovements) + assertEquals(testString, result.scenarios.first().controlProceduralStrengths) + assertEquals(testString, result.scenarios.first().controlProceduralImprovements) + assertEquals(testString, result.scenarios.first().controlStrengths) + assertEquals(testString, result.scenarios.first().controlImprovements) + assertEquals(testString, result.scenarios.first().conservatismStrengths) + assertEquals(testString, result.scenarios.first().conservatismImprovements) + assertEquals(testString, result.scenarios.first().teamworkCommunicationsStrengths) + assertEquals(testString, result.scenarios.first().teamworkCommunicationsImprovements) + assertEquals(testString, result.scenarios.first().teamworkLeadershipStrengths) + assertEquals(testString, result.scenarios.first().teamworkLeadershipImprovements) + assertEquals(testString, result.scenarios.first().teamworkWorkloadStrengths) + assertEquals(testString, result.scenarios.first().teamworkWorkloadImprovements) + assertEquals(testString, result.scenarios.first().knowledgeStrengths) + assertEquals(testString, result.scenarios.first().knowledgeImprovements) } }