Increased testing on long strings in scenario submissions

This commit is contained in:
neviyn 2020-02-26 14:24:01 +00:00
parent e1df1142ce
commit aba1b91eec

View File

@ -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)
}
}