@@ -186,12 +186,13 @@ void saveContextualVariables_previous_test(
186186 Consumer <ContextualPreviousVariableDocument > assertionsForDoc
187187 ) {
188188 //GIVEN
189- Files .createDirectories (SOURCE_PATH_PREVIOUS );
189+ Path contextualPath = SOURCE_PATH_PREVIOUS .resolve ("contextual" );
190+ Files .createDirectories (contextualPath );
190191 Files .copy (
191192 Path .of (TestConstants .TEST_RESOURCES_DIRECTORY )
192193 .resolve ("contextual_previous" )
193194 .resolve ("ok.json" ),
194- SOURCE_PATH_PREVIOUS .resolve ("ok.json" ),
195+ contextualPath .resolve ("ok.json" ),
195196 StandardCopyOption .REPLACE_EXISTING
196197 );
197198
@@ -283,12 +284,13 @@ void saveContextualVariables_external_test( String interrogationId,
283284 int expectedVarCount ,
284285 Consumer <ContextualExternalVariableDocument > assertionsForDoc ) {
285286 //GIVEN
286- Files .createDirectories (SOURCE_PATH_EXTERNAL );
287+ Path contextualPath = SOURCE_PATH_EXTERNAL .resolve ("contextual" );
288+ Files .createDirectories (contextualPath );
287289 Files .copy (
288290 Path .of (TestConstants .TEST_RESOURCES_DIRECTORY )
289291 .resolve ("contextual_external" )
290292 .resolve ("ok.json" ),
291- SOURCE_PATH_EXTERNAL .resolve ("ok.json" ),
293+ contextualPath .resolve ("ok.json" ),
292294 StandardCopyOption .REPLACE_EXISTING
293295 );
294296
@@ -400,10 +402,13 @@ void readPreviousJson_sourceState(String sourceState){
400402
401403 private void testOKCase (String sourceState ) throws IOException {
402404 //GIVEN
403- Files .createDirectories (SOURCE_PATH_PREVIOUS );
405+ Path contextualPath = SOURCE_PATH_PREVIOUS .resolve ("contextual" );
406+ Files .createDirectories (contextualPath );
404407 Files .copy (
405- Path .of (TestConstants .TEST_RESOURCES_DIRECTORY ).resolve ("contextual_previous" ).resolve ("ok.json" ),
406- SOURCE_PATH_PREVIOUS .resolve ("ok.json" ),
408+ Path .of (TestConstants .TEST_RESOURCES_DIRECTORY )
409+ .resolve ("contextual_previous" )
410+ .resolve ("ok.json" ),
411+ contextualPath .resolve ("ok.json" ),
407412 StandardCopyOption .REPLACE_EXISTING
408413 );
409414
@@ -484,19 +489,22 @@ void readPreviousJson_override_interrogation_id( String interrogationId,
484489 int expectedVarCount ,
485490 Consumer <ContextualPreviousVariableDocument > assertionsForDoc ){
486491 //GIVEN
487- Files .createDirectories (SOURCE_PATH_PREVIOUS );
492+ Path contextualPath = SOURCE_PATH_PREVIOUS .resolve ("contextual" );
493+ Files .createDirectories (contextualPath );
488494 Path path = Path .of (TestConstants .TEST_RESOURCES_DIRECTORY );
489495 Files .copy (
490-
491- path . resolve ( "contextual_previous" ) .resolve ("ok.json" ),
492- SOURCE_PATH_PREVIOUS .resolve ("ok.json" ),
496+ path . resolve ( "contextual_previous" )
497+ .resolve ("ok.json" ),
498+ contextualPath .resolve ("ok.json" ),
493499 StandardCopyOption .REPLACE_EXISTING
494500 );
495501 contextualVariableController .readContextualPreviousJson (QUESTIONNAIRE_ID_PREVIOUS , Mode .WEB , null , "ok.json" );
496502 Files .createDirectories (SOURCE_PATH_PREVIOUS );
503+
497504 Files .copy (
498- path .resolve ("contextual_previous" ).resolve ("ok2.json" ),
499- SOURCE_PATH_PREVIOUS .resolve ("ok2.json" ),
505+ path .resolve ("contextual_previous" )
506+ .resolve ("ok2.json" ),
507+ contextualPath .resolve ("ok2.json" ),
500508 StandardCopyOption .REPLACE_EXISTING
501509 );
502510
@@ -587,10 +595,13 @@ static Stream<Arguments> overridePreviousCases() {
587595 void readPreviousJson_sourceState_too_long (String sourceState ){
588596 //GIVEN
589597 String fileName = "ok.json" ;
590- Files .createDirectories (SOURCE_PATH_PREVIOUS );
598+ Path contextualPath = SOURCE_PATH_PREVIOUS .resolve ("contextual" );
599+ Files .createDirectories (contextualPath );
591600 Files .copy (
592- Path .of (TestConstants .TEST_RESOURCES_DIRECTORY ).resolve ("contextual_previous" ).resolve (fileName ),
593- SOURCE_PATH_PREVIOUS .resolve (fileName ),
601+ Path .of (TestConstants .TEST_RESOURCES_DIRECTORY )
602+ .resolve ("contextual_previous" )
603+ .resolve (fileName ),
604+ contextualPath .resolve (fileName ),
594605 StandardCopyOption .REPLACE_EXISTING
595606 );
596607
@@ -605,10 +616,13 @@ void readPreviousJson_sourceState_too_long(String sourceState){
605616 void readPreviousJson_invalid_syntax (){
606617 String syntaxErrorFileName = "invalid_syntax.json" ;
607618 //GIVEN
608- Files .createDirectories (SOURCE_PATH_PREVIOUS );
619+ Path contextualPath = SOURCE_PATH_PREVIOUS .resolve ("contextual" );
620+ Files .createDirectories (contextualPath );
609621 Files .copy (
610- Path .of (TestConstants .TEST_RESOURCES_DIRECTORY ).resolve ("contextual_previous" ).resolve (syntaxErrorFileName ),
611- SOURCE_PATH_PREVIOUS .resolve (syntaxErrorFileName ),
622+ Path .of (TestConstants .TEST_RESOURCES_DIRECTORY )
623+ .resolve ("contextual_previous" )
624+ .resolve (syntaxErrorFileName ),
625+ contextualPath .resolve (syntaxErrorFileName ),
612626 StandardCopyOption .REPLACE_EXISTING
613627 );
614628
@@ -622,10 +636,13 @@ void readPreviousJson_invalid_syntax(){
622636 void readPreviousJson_not_a_json (){
623637 String syntaxErrorFileName = "not_a_json.xml" ;
624638 //GIVEN
625- Files .createDirectories (SOURCE_PATH_PREVIOUS );
639+ Path contextualPath = SOURCE_PATH_PREVIOUS .resolve ("contextual" );
640+ Files .createDirectories (contextualPath );
626641 Files .copy (
627- Path .of (TestConstants .TEST_RESOURCES_DIRECTORY ).resolve ("contextual_previous" ).resolve (syntaxErrorFileName ),
628- SOURCE_PATH_PREVIOUS .resolve (syntaxErrorFileName ),
642+ Path .of (TestConstants .TEST_RESOURCES_DIRECTORY )
643+ .resolve ("contextual_previous" )
644+ .resolve (syntaxErrorFileName ),
645+ contextualPath .resolve (syntaxErrorFileName ),
629646 StandardCopyOption .REPLACE_EXISTING
630647 );
631648
@@ -642,10 +659,13 @@ void readPreviousJson_not_a_json(){
642659 @ DisplayName ("Previous json return 400 if no interrogationId, only one interrogationId, or double interrogationId" )
643660 void readPreviousJson_no_interrogation_id (String fileName ){
644661 //GIVEN
645- Files .createDirectories (SOURCE_PATH_PREVIOUS );
662+ Path contextualPath = SOURCE_PATH_PREVIOUS .resolve ("contextual" );
663+ Files .createDirectories (contextualPath );
646664 Files .copy (
647- Path .of (TestConstants .TEST_RESOURCES_DIRECTORY ).resolve ("contextual_previous" ).resolve (fileName ),
648- SOURCE_PATH_PREVIOUS .resolve (fileName ),
665+ Path .of (TestConstants .TEST_RESOURCES_DIRECTORY )
666+ .resolve ("contextual_previous" )
667+ .resolve (fileName ),
668+ contextualPath .resolve (fileName ),
649669 StandardCopyOption .REPLACE_EXISTING
650670 );
651671
@@ -662,10 +682,13 @@ void readExternalJson_test( String interrogationId,
662682 int expectedVarCount ,
663683 Consumer <ContextualExternalVariableDocument > assertionsForDoc ){
664684 //GIVEN
665- Files .createDirectories (SOURCE_PATH_EXTERNAL );
685+ Path contextualPath = SOURCE_PATH_EXTERNAL .resolve ("contextual" );
686+ Files .createDirectories (contextualPath );
666687 Files .copy (
667- Path .of (TestConstants .TEST_RESOURCES_DIRECTORY ).resolve ("contextual_external" ).resolve ("ok.json" ),
668- SOURCE_PATH_EXTERNAL .resolve ("ok.json" ),
688+ Path .of (TestConstants .TEST_RESOURCES_DIRECTORY )
689+ .resolve ("contextual_external" )
690+ .resolve ("ok.json" ),
691+ contextualPath .resolve ("ok.json" ),
669692 StandardCopyOption .REPLACE_EXISTING
670693 );
671694
@@ -742,18 +765,21 @@ void readExternalJson_override_interrogation_id( String interrogationId,
742765 Consumer <ContextualExternalVariableDocument > assertionsForDoc
743766 ){
744767 //GIVEN
745- Files . createDirectories ( SOURCE_PATH_EXTERNAL );
768+ Path contextualPath = SOURCE_PATH_EXTERNAL . resolve ( "contextual" );
746769 Path path = Path .of (TestConstants .TEST_RESOURCES_DIRECTORY );
770+ Files .createDirectories (contextualPath );
747771 Files .copy (
748- path .resolve ("contextual_external" ).resolve ("ok.json" ),
749- SOURCE_PATH_EXTERNAL .resolve ("ok.json" ),
772+ path .resolve ("contextual_external" )
773+ .resolve ("ok.json" ),
774+ contextualPath .resolve ("ok.json" ),
750775 StandardCopyOption .REPLACE_EXISTING
751776 );
752777 contextualVariableController .readContextualExternalJson (QUESTIONNAIRE_ID_EXTERNAL , Mode .WEB , "ok.json" );
753778 Files .createDirectories (SOURCE_PATH_EXTERNAL );
754779 Files .copy (
755- path .resolve ("contextual_external" ).resolve ("ok2.json" ),
756- SOURCE_PATH_EXTERNAL .resolve ("ok2.json" ),
780+ path .resolve ("contextual_external" )
781+ .resolve ("ok2.json" ),
782+ contextualPath .resolve ("ok2.json" ),
757783 StandardCopyOption .REPLACE_EXISTING
758784 );
759785
@@ -839,10 +865,14 @@ static Stream<Arguments> overrideExternalCases() {
839865 @ SneakyThrows
840866 void readExternalJson_error_400 (String fileName ){
841867 //GIVEN
842- Files .createDirectories (SOURCE_PATH_EXTERNAL );
868+ Path contextualPath = SOURCE_PATH_EXTERNAL .resolve ("contextual" );
869+ Files .createDirectories (contextualPath );
870+
843871 Files .copy (
844- Path .of (TestConstants .TEST_RESOURCES_DIRECTORY ).resolve ("contextual_external" ).resolve (fileName ),
845- SOURCE_PATH_EXTERNAL .resolve (fileName ),
872+ Path .of (TestConstants .TEST_RESOURCES_DIRECTORY )
873+ .resolve ("contextual_external" )
874+ .resolve (fileName ),
875+ contextualPath .resolve (fileName ),
846876 StandardCopyOption .REPLACE_EXISTING
847877 );
848878
0 commit comments