@@ -57,11 +57,11 @@ void generateHttpScenarios(String version) {
5757 OpenApiSpecification openApiSpecification = createOpenApiSpecification (version );
5858 fixture = new HttpScenarioGenerator (openApiSpecification );
5959
60- String addPetScenarioId = "POST_/petstore/" +version +"/pet" ;
61- String getPetScenarioId = "GET_/petstore/" +version +"/pet/{petId}" ;
62- String deletePetScenarioId = "DELETE_/petstore/" +version +"/pet/{petId}" ;
60+ String addPetScenarioId = "POST_/api/ petstore/" +version +"/pet" ;
61+ String getPetScenarioId = "GET_/api/ petstore/" +version +"/pet/{petId}" ;
62+ String deletePetScenarioId = "DELETE_/api/ petstore/" +version +"/pet/{petId}" ;
6363
64- String context = "/petstore/" + version ;
64+ String context = "/api/ petstore/" + version ;
6565 doAnswer (invocation -> {
6666 HttpOperationScenario scenario = (HttpOperationScenario ) invocation .getArguments ()[1 ];
6767 assertScenarioProperties (scenario , context +"/pet" , addPetScenarioId , "POST" );
@@ -90,7 +90,7 @@ void generateHttpScenarios(String version) {
9090 private static OpenApiSpecification createOpenApiSpecification (String version ) {
9191 OpenApiSpecification openApiSpecification = OpenApiSpecification .from (new ClasspathResource (
9292 "swagger/petstore-" + version + ".json" ));
93- openApiSpecification .setRootContextPath ("/petstore/" + version );
93+ openApiSpecification .setRootContextPath ("/api" );
9494 return openApiSpecification ;
9595 }
9696
@@ -104,31 +104,31 @@ void testGenerateScenariosWithBeanDefinitionRegistry(String version) {
104104 OpenApiSpecification openApiSpecification = createOpenApiSpecification (version );
105105 fixture = new HttpScenarioGenerator (openApiSpecification );
106106
107- String context = openApiSpecification .getRootContextPath ();
107+ String context = openApiSpecification .getFullContextPath ();
108108
109109 doAnswer (invocation -> {
110110 BeanDefinition scenario = (BeanDefinition ) invocation .getArguments ()[1 ];
111- assertBeanDefinition (scenario , context +"/pet" , "POST_/petstore/" +version +"/pet" , "post" , false );
111+ assertBeanDefinition (scenario , context +"/pet" , "POST_/api/ petstore/" +version +"/pet" , "post" , false );
112112 return null ;
113- }).when (beanRegistryMock ).registerBeanDefinition (eq ("POST_/petstore/" +version +"/pet" ), any (BeanDefinition .class ));
113+ }).when (beanRegistryMock ).registerBeanDefinition (eq ("POST_/api/ petstore/" +version +"/pet" ), any (BeanDefinition .class ));
114114
115115 doAnswer (invocation -> {
116116 BeanDefinition scenario = (BeanDefinition ) invocation .getArguments ()[1 ];
117- assertBeanDefinition (scenario , context +"/pet/{petId}" , "GET_/petstore/" +version +"/pet/{petId}" , "get" , false );
117+ assertBeanDefinition (scenario , context +"/pet/{petId}" , "GET_/api/ petstore/" +version +"/pet/{petId}" , "get" , false );
118118 return null ;
119- }).when (beanRegistryMock ).registerBeanDefinition (eq ("GET_/petstore/" +version +"/pet/{petId}" ), any (BeanDefinition .class ));
119+ }).when (beanRegistryMock ).registerBeanDefinition (eq ("GET_/api/ petstore/" +version +"/pet/{petId}" ), any (BeanDefinition .class ));
120120
121121 doAnswer (invocation -> {
122122 BeanDefinition scenario = (BeanDefinition ) invocation .getArguments ()[1 ];
123- assertBeanDefinition (scenario , context +"/pet/{petId}" , "DELETE_/petstore/" +version +"/pet/{petId}" , "delete" , false );
123+ assertBeanDefinition (scenario , context +"/pet/{petId}" , "DELETE_/api/ petstore/" +version +"/pet/{petId}" , "delete" , false );
124124 return null ;
125- }).when (beanRegistryMock ).registerBeanDefinition (eq ("DELETE_/petstore/" +version +"/pet/{petId}" ), any (BeanDefinition .class ));
125+ }).when (beanRegistryMock ).registerBeanDefinition (eq ("DELETE_/api/ petstore/" +version +"/pet/{petId}" ), any (BeanDefinition .class ));
126126
127127 fixture .postProcessBeanFactory (beanRegistryMock );
128128
129- verify (beanRegistryMock ).registerBeanDefinition (eq ("POST_/petstore/" +version +"/pet" ), any (BeanDefinition .class ));
130- verify (beanRegistryMock ).registerBeanDefinition (eq ("GET_/petstore/" +version +"/pet/{petId}" ), any (BeanDefinition .class ));
131- verify (beanRegistryMock ).registerBeanDefinition (eq ("DELETE_/petstore/" +version +"/pet/{petId}" ), any (BeanDefinition .class ));
129+ verify (beanRegistryMock ).registerBeanDefinition (eq ("POST_/api/ petstore/" +version +"/pet" ), any (BeanDefinition .class ));
130+ verify (beanRegistryMock ).registerBeanDefinition (eq ("GET_/api/ petstore/" +version +"/pet/{petId}" ), any (BeanDefinition .class ));
131+ verify (beanRegistryMock ).registerBeanDefinition (eq ("DELETE_/api/ petstore/" +version +"/pet/{petId}" ), any (BeanDefinition .class ));
132132 }
133133
134134 @ ParameterizedTest
@@ -142,11 +142,11 @@ void testGenerateScenariosWithDataDictionariesAtRootContext(String version) {
142142
143143 fixture = new HttpScenarioGenerator (openApiSpecification );
144144
145- String addPetScenarioId = "POST_/services/rest2/pet" ;
146- String getPetScenarioId = "GET_/services/rest2/pet/{petId}" ;
147- String deletePetScenarioId = "DELETE_/services/rest2/pet/{petId}" ;
145+ String addPetScenarioId = "POST_/services/rest2/petstore/" + version + "/ pet" ;
146+ String getPetScenarioId = "GET_/services/rest2/petstore/" + version + "/ pet/{petId}" ;
147+ String deletePetScenarioId = "DELETE_/services/rest2/petstore/" + version + "/ pet/{petId}" ;
148148
149- String context = fixture . getContextPath ();
149+ String context = openApiSpecification . getFullContextPath ();
150150
151151 doReturn (true ).when (beanRegistryMock ).containsBeanDefinition ("inboundJsonDataDictionary" );
152152 doReturn (true ).when (beanRegistryMock ).containsBeanDefinition ("outboundJsonDataDictionary" );
0 commit comments