package Ġuk . gov . just ice . digital . as sess ments . services Ċ Ċ import Ġio . mock k . every Ċ import Ġio . mock k . junit 5 . Mock K Extension Ċ import Ġio . mock k . mock k Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . DisplayName Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . extension . Extend With Ċ import Ġuk . gov . just ice . digital . as sess ments . api . Update Assessment Episode Dto Ċ import Ġuk . gov . just ice . digital . as sess ments . jpa . entities . Assessment Schema Code Ċ import Ġuk . gov . just ice . digital . as sess ments . jpa . entities . as sess ments . Assessment Entity Ċ import Ġuk . gov . just ice . digital . as sess ments . jpa . entities . as sess ments . Assessment Episode Entity Ċ import Ġuk . gov . just ice . digital . as sess ments . jpa . entities . as sess ments . Author Entity Ċ import Ġuk . gov . just ice . digital . as sess ments . jpa . entities . ref data . O as ys Assessment Type Ċ import Ġuk . gov . just ice . digital . as sess ments . jpa . entities . ref data . Question Schema Entity Ċ import Ġuk . gov . just ice . digital . as sess ments . jpa . repositories . as sess ments . Assessment Repository Ċ import Ġuk . gov . just ice . digital . as sess ments . jpa . repositories . as sess ments . Episode Repository Ċ import Ġuk . gov . just ice . digital . as sess ments . services . dto . Assessment Episode Update Errors Ċ import Ġjava . util . UUID Ċ Ċ @ Extend With ( Mock K Extension :: class ) Ċ @ DisplayName (" Assessment ĠService ĠTables ĠTests ") Ċ class ĠAssessment Update Service Tables Test Ġ{ ĊĠ Ġprivate Ġval Ġassessment Repository : ĠAssessment Repository Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġepisode Repository : ĠEp isode Repository Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġquestion Service : ĠQuestion Service Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġrisk Predict ors Service : ĠR isk Predict ors Service Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġassessment Schema Service : ĠAssessment Schema Service Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġo as ys Assessment Update Service : ĠO as ys Assessment Update Service Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġassessment Service : ĠAssessment Service Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġauthor Service : ĠAuthor Service Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġaudit Service : ĠAudit Service Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġtelemetry Service : ĠTe lemetry Service Ġ= Ġmock k () ĊĊĠ Ġprivate Ġval Ġassessment Update Service Ġ= ĠAssessment Update Service ( ĊĠĠĠ Ġassessment Repository , ĊĠĠĠ Ġepisode Repository , ĊĠĠĠ Ġquestion Service , ĊĠĠĠ Ġrisk Predict ors Service , ĊĠĠĠ Ġo as ys Assessment Update Service , ĊĠĠĠ Ġassessment Service , ĊĠĠĠ Ġauthor Service , ĊĠĠĠ Ġaudit Service , ĊĠĠĠ Ġtelemetry Service ĊĠ Ġ) ĊĊĠ Ġprivate Ġval ĠtableName Ġ= Ġ" test _ table " ĊĊĠ Ġprivate Ġval Ġtable Fields Ġ= ĠQuestion Schema Entities ( ĊĠĠĠ ĠlistOf ( ĊĠĠĠĠĠ ĠQuestion Schema Entity ( ĊĠĠĠĠĠĠĠ Ġquestion Schema Id Ġ= Ġ 1 L , ĊĠĠĠĠĠĠĠ Ġquestion Schema Uuid Ġ= ĠUUID . randomUUID (), ĊĠĠĠĠĠĠĠ Ġquestion Code Ġ= Ġ" first _ question ", ĊĠĠĠĠĠ Ġ), ĊĠĠĠĠĠ ĠQuestion Schema Entity ( ĊĠĠĠĠĠĠĠ Ġquestion Schema Id Ġ= Ġ 2 L , ĊĠĠĠĠĠĠĠ Ġquestion Schema Uuid Ġ= ĠUUID . randomUUID (), ĊĠĠĠĠĠĠĠ Ġquestion Code Ġ= Ġ" second _ question ", ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ) ĊĊĠ Ġprivate Ġval Ġassessment Uuid Ġ= ĠUUID . randomUUID () ĊĠ Ġprivate Ġval Ġepisode Uuid Ġ= ĠUUID . randomUUID () ĊĠ Ġprivate Ġval Ġassessment Episode Ġ= ĠAssessment Episode Entity ( ĊĠĠĠ Ġepisode Id Ġ= Ġ 1 L , ĊĠĠĠ Ġepisode Uuid Ġ= Ġepisode Uuid , ĊĠĠĠ Ġassessment Schema Code Ġ= ĠAssessment Schema Code . RO SH , ĊĠĠĠ Ġauthor Ġ= ĠAuthor Entity ( userId Ġ= Ġ" 1 ", ĠuserName Ġ= Ġ" USER ", Ġuser Auth Source Ġ= Ġ" source ", Ġuser FullName Ġ= Ġ" full Ġname "), ĊĠĠĠ Ġassessment Ġ= ĠAssessment Entity () ĊĠ Ġ) ĊĊĠ Ġ@ BeforeEach ĊĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠ Ġevery Ġ{ Ġassessment Schema Service . to O as ys Assessment Type ( Assessment Schema Code . RO SH ) Ġ} Ġreturns ĠO as ys Assessment Type . SHORT _ FORM _ PS R ĊĠĠĠ Ġevery Ġ{ Ġassessment Schema Service . to O as ys Assessment Type ( Assessment Schema Code . R SR ) Ġ} Ġreturns ĠO as ys Assessment Type . SO METH ING _ IN _ O AS YS ĊĠĠĠ Ġevery Ġ{ Ġepisode Repository . save ( any ()) Ġ} Ġreturns Ġnull ĊĠĠĠ Ġevery Ġ{ Ġassessment Repository . save ( any ()) Ġ} Ġreturns Ġnull ĊĠĠĠ Ġevery Ġ{ ĊĠĠĠĠĠ Ġo as ys Assessment Update Service . update O AS ys Assessment ( any ()) ĊĠĠĠ Ġ} Ġreturns ĠAssessment Episode Update Errors () ĊĠĠĠ Ġevery Ġ{ Ġassessment Service . getCurrent Episode ( assessment Uuid ) Ġ} Ġreturns Ġassessment Episode ĊĠĠĠ Ġevery Ġ{ Ġassessment Service . get Episode ( assessment Uuid , Ġepisode Uuid ) Ġ} Ġreturns Ġassessment Episode ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` adds Ġan Ġentry Ġto Ġa Ġtable Ġfor Ġa Ġgiven Ġepisode `() Ġ{ ĊĠĠĠ Ġval Ġrequest Body Ġ= ĠUpdate Assessment Episode Dto ( ĊĠĠĠĠĠ Ġanswers Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" first _ answer "), ĊĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġevery Ġ{ Ġquestion Service . getAll Group Questions By Group Code ( tableName ) Ġ} Ġreturns Ġtable Fields ĊĊĠĠĠ Ġval Ġupdated Episode Ġ= Ġassessment Update Service . add Entry ToTable For Episode ( ĊĠĠĠĠĠ Ġassessment Uuid , ĊĠĠĠĠĠ Ġepisode Uuid , ĊĠĠĠĠĠ ĠtableName , ĊĠĠĠĠĠ Ġrequest Body , ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( updated Episode . tables . size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. first ()). isEqualTo ( ĊĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" first _ answer "), ĊĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` adds Ġan Ġentry Ġto Ġa Ġtable Ġfor Ġthe Ġcurrent Ġepisode `() Ġ{ ĊĠĠĠ Ġval Ġrequest Body Ġ= ĠUpdate Assessment Episode Dto ( ĊĠĠĠĠĠ Ġanswers Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" first _ answer "), ĊĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġevery Ġ{ Ġquestion Service . getAll Group Questions By Group Code ( tableName ) Ġ} Ġreturns Ġtable Fields ĊĊĠĠĠ Ġval Ġupdated Episode Ġ= Ġassessment Update Service . add Entry ToTable For Current Episode ( ĊĠĠĠĠĠ Ġassessment Uuid , ĊĠĠĠĠĠ ĠtableName , ĊĠĠĠĠĠ Ġrequest Body , ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( updated Episode . tables . size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. first ()). isEqualTo ( ĊĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" first _ answer "), ĊĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` only Ġstores Ġfields Ġdefined Ġin Ġthe Ġquestion Ġgroup `() Ġ{ ĊĠĠĠ Ġval Ġrequest Body Ġ= ĠUpdate Assessment Episode Dto ( ĊĠĠĠĠĠ Ġanswers Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" first _ answer "), ĊĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠĠĠ Ġ" third _ question " Ġto ĠlistOf (" third _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġevery Ġ{ Ġquestion Service . getAll Group Questions By Group Code ( tableName ) Ġ} Ġreturns Ġtable Fields ĊĊĠĠĠ Ġval Ġupdated Episode Ġ= Ġassessment Update Service . add Entry ToTable For Episode ( ĊĠĠĠĠĠ Ġassessment Uuid , ĊĠĠĠĠĠ Ġepisode Uuid , ĊĠĠĠĠĠ ĠtableName , ĊĠĠĠĠĠ Ġrequest Body , ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( updated Episode . tables . size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. first ()). isEqualTo ( ĊĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" first _ answer "), ĊĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` updates Ġentries Ġfor Ġa Ġgiven Ġtable Ġin Ġan Ġepisode `() Ġ{ ĊĠĠĠ Ġval Ġepisode Uuid Ġ= ĠUUID . randomUUID () ĊĠĠĠ Ġval Ġassessment Episode With Existing Table Ġ= ĠAssessment Episode Entity ( ĊĠĠĠĠĠ Ġepisode Id Ġ= Ġ 1 L , ĊĠĠĠĠĠ Ġepisode Uuid Ġ= Ġepisode Uuid , ĊĠĠĠĠĠ Ġassessment Schema Code Ġ= ĠAssessment Schema Code . RO SH , ĊĠĠĠĠĠ Ġtables Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠ ĠtableName Ġto Ġmutable ListOf ( ĊĠĠĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" first _ answer "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġ), ĊĠĠĠĠĠ Ġauthor Ġ= ĠAuthor Entity ( userId Ġ= Ġ" 1 ", ĠuserName Ġ= Ġ" USER ", Ġuser Auth Source Ġ= Ġ" source ", Ġuser FullName Ġ= Ġ" full Ġname "), ĊĠĠĠĠĠ Ġassessment Ġ= ĠAssessment Entity () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġrequest Body Ġ= ĠUpdate Assessment Episode Dto ( ĊĠĠĠĠĠ Ġanswers Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" updated _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġevery Ġ{ Ġquestion Service . getAll Group Questions By Group Code ( tableName ) Ġ} Ġreturns Ġtable Fields ĊĠĠĠ Ġevery Ġ{ Ġassessment Service . get Episode ( assessment Uuid , Ġepisode Uuid ) Ġ} Ġreturns Ġassessment Episode With Existing Table ĊĊĠĠĠ Ġval Ġupdated Episode Ġ= Ġassessment Update Service . update Entry ToTable For Episode ( ĊĠĠĠĠĠ Ġassessment Uuid , ĊĠĠĠĠĠ Ġepisode Uuid , ĊĠĠĠĠĠ ĠtableName , ĊĠĠĠĠĠ Ġrequest Body , ĊĠĠĠĠĠĠ 0 , ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( updated Episode . tables . size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. first ()). isEqualTo ( ĊĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" updated _ answer "), ĊĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` updates Ġentries Ġfor Ġa Ġgiven Ġtable Ġin Ġthe Ġcurrent Ġepisode `() Ġ{ ĊĠĠĠ Ġval Ġepisode Uuid Ġ= ĠUUID . randomUUID () ĊĠĠĠ Ġval Ġassessment Episode With Existing Table Ġ= ĠAssessment Episode Entity ( ĊĠĠĠĠĠ Ġepisode Id Ġ= Ġ 1 L , ĊĠĠĠĠĠ Ġepisode Uuid Ġ= Ġepisode Uuid , ĊĠĠĠĠĠ Ġassessment Schema Code Ġ= ĠAssessment Schema Code . RO SH , ĊĠĠĠĠĠ Ġauthor Ġ= ĠAuthor Entity ( userId Ġ= Ġ" 1 ", ĠuserName Ġ= Ġ" USER ", Ġuser Auth Source Ġ= Ġ" source ", Ġuser FullName Ġ= Ġ" full Ġname "), ĊĠĠĠĠĠ Ġassessment Ġ= ĠAssessment Entity (), ĊĠĠĠĠĠ Ġtables Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠ ĠtableName Ġto Ġmutable ListOf ( ĊĠĠĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" first _ answer "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġrequest Body Ġ= ĠUpdate Assessment Episode Dto ( ĊĠĠĠĠĠ Ġanswers Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" updated _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġevery Ġ{ Ġquestion Service . getAll Group Questions By Group Code ( tableName ) Ġ} Ġreturns Ġtable Fields ĊĠĠĠ Ġevery Ġ{ Ġassessment Service . getCurrent Episode ( assessment Uuid ) Ġ} Ġreturns Ġassessment Episode With Existing Table ĊĊĠĠĠ Ġval Ġupdated Episode Ġ= Ġassessment Update Service . update Entry ToTable For Current Episode ( ĊĠĠĠĠĠ Ġassessment Uuid , ĊĠĠĠĠĠ ĠtableName , ĊĠĠĠĠĠ Ġrequest Body , ĊĠĠĠĠĠĠ 0 , ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( updated Episode . tables . size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. first ()). isEqualTo ( ĊĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" updated _ answer "), ĊĠĠĠĠĠĠĠ Ġ" second _ question " Ġto ĠlistOf (" second _ answer "), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` remove Ġan Ġentry Ġfor Ġa Ġgiven Ġindex `() Ġ{ ĊĠĠĠ Ġval Ġepisode Uuid Ġ= ĠUUID . randomUUID () ĊĠĠĠ Ġval Ġassessment Episode With Existing Table Ġ= ĠAssessment Episode Entity ( ĊĠĠĠĠĠ Ġepisode Id Ġ= Ġ 1 L , ĊĠĠĠĠĠ Ġepisode Uuid Ġ= Ġepisode Uuid , ĊĠĠĠĠĠ Ġassessment Schema Code Ġ= ĠAssessment Schema Code . RO SH , ĊĠĠĠĠĠ Ġauthor Ġ= ĠAuthor Entity ( userId Ġ= Ġ" 1 ", ĠuserName Ġ= Ġ" USER ", Ġuser Auth Source Ġ= Ġ" source ", Ġuser FullName Ġ= Ġ" full Ġname "), ĊĠĠĠĠĠ Ġassessment Ġ= ĠAssessment Entity (), ĊĠĠĠĠĠ Ġtables Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠ ĠtableName Ġto Ġmutable ListOf ( ĊĠĠĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ first _ entry "), ĊĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ second _ entry "), ĊĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ third _ entry "), ĊĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġevery Ġ{ Ġquestion Service . getAll Group Questions By Group Code ( tableName ) Ġ} Ġreturns Ġtable Fields ĊĠĠĠ Ġevery Ġ{ Ġassessment Service . get Episode ( assessment Uuid , Ġepisode Uuid ) Ġ} Ġreturns Ġassessment Episode With Existing Table ĊĊĠĠĠ Ġval Ġupdated Episode Ġ= Ġassessment Update Service . delete Entry ToTable For Episode ( ĊĠĠĠĠĠ Ġassessment Uuid , ĊĠĠĠĠĠ Ġepisode Uuid , ĊĠĠĠĠĠ ĠtableName , ĊĠĠĠĠĠĠ 1 , ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( updated Episode . tables . size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. size ). isEqualTo ( 2 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]). isEqualTo ( ĊĠĠĠĠĠ Ġmutable ListOf ( ĊĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ first _ entry "), ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ third _ entry "), ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` remove Ġan Ġentry Ġfor Ġa Ġgiven Ġindex Ġin Ġthe Ġcurrent Ġepisode `() Ġ{ ĊĠĠĠ Ġval Ġepisode Uuid Ġ= ĠUUID . randomUUID () ĊĠĠĠ Ġval Ġassessment Episode With Existing Table Ġ= ĠAssessment Episode Entity ( ĊĠĠĠĠĠ Ġepisode Id Ġ= Ġ 1 L , ĊĠĠĠĠĠ Ġepisode Uuid Ġ= Ġepisode Uuid , ĊĠĠĠĠĠ Ġassessment Schema Code Ġ= ĠAssessment Schema Code . RO SH , ĊĠĠĠĠĠ Ġauthor Ġ= ĠAuthor Entity ( userId Ġ= Ġ" 1 ", ĠuserName Ġ= Ġ" USER ", Ġuser Auth Source Ġ= Ġ" source ", Ġuser FullName Ġ= Ġ" full Ġname "), ĊĠĠĠĠĠ Ġassessment Ġ= ĠAssessment Entity (), ĊĠĠĠĠĠ Ġtables Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠ ĠtableName Ġto Ġmutable ListOf ( ĊĠĠĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ first _ entry "), ĊĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ second _ entry "), ĊĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ third _ entry "), ĊĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġevery Ġ{ Ġquestion Service . getAll Group Questions By Group Code ( tableName ) Ġ} Ġreturns Ġtable Fields ĊĠĠĠ Ġevery Ġ{ Ġassessment Service . getCurrent Episode ( assessment Uuid ) Ġ} Ġreturns Ġassessment Episode With Existing Table ĊĊĠĠĠ Ġval Ġupdated Episode Ġ= Ġassessment Update Service . delete Entry ToTable For Current Episode ( ĊĠĠĠĠĠ Ġassessment Uuid , ĊĠĠĠĠĠ ĠtableName , ĊĠĠĠĠĠĠ 1 , ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( updated Episode . tables . size ). isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]?. size ). isEqualTo ( 2 ) ĊĠĠĠ ĠassertThat ( updated Episode . tables [ tableName ]). isEqualTo ( ĊĠĠĠĠĠ Ġmutable ListOf ( ĊĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ first _ entry "), ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠ Ġ" first _ question " Ġto ĠlistOf (" for _ third _ entry "), ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} Ċ } Ċ