Skip to content

Commit

Permalink
fix(velocity): replace velocityCount with foreach.count
Browse files Browse the repository at this point in the history
  • Loading branch information
rbioteau committed Sep 27, 2024
1 parent 81efaf8 commit 156c376
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class IndexTest extends Specification {
#if( $nbParams != 0 )// Simulate a request with a value for each parameter
#end
#foreach($urlParameter in $params)
httpRequest.getParameter("$urlParameter") >> "aValue$velocityCount"
httpRequest.getParameter("$urlParameter") >> "aValue$foreach.count"
#end
when: "Invoking the REST API"
Expand All @@ -62,7 +62,7 @@ class IndexTest extends Specification {
def jsonResponse = new JsonSlurper().parseText(apiResponse.response)
// Validate returned response
apiResponse.httpStatus == 200
#foreach($urlParameter in $params) jsonResponse.$urlParameter == "aValue$velocityCount"
#foreach($urlParameter in $params) jsonResponse.$urlParameter == "aValue$foreach.count"
#end
jsonResponse.myParameterKey == "testValue"
jsonResponse.currentDate == LocalDate.now().toString()
Expand All @@ -76,7 +76,7 @@ class IndexTest extends Specification {
#if( $nbParams != 0 )// Other parameters return a valid value
#end
#foreach($p in $params)#if($p != $urlParameter)
httpRequest.getParameter("$p") >> "aValue$velocityCount"
httpRequest.getParameter("$p") >> "aValue$foreach.count"
#end#end
when: "Invoking the REST API"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void should_get_result_when_params_ok() {

// Given
#foreach ($urlParameter in $params)
String $urlParameter = "aValue$velocityCount";
String $urlParameter = "aValue$foreach.count";
#end

// When
Expand All @@ -108,7 +108,7 @@ void should_return_a_json_representation_as_result() throws IOException {

// Simulate a request with a value for each parameter
#foreach($urlParameter in $params)
when(httpRequest.getParameter("$urlParameter")).thenReturn("aValue$velocityCount");
when(httpRequest.getParameter("$urlParameter")).thenReturn("aValue$foreach.count");
#end

// When "Invoking the REST API"
Expand All @@ -128,7 +128,7 @@ void should_return_a_json_representation_as_result() throws IOException {
// Given "a request without $urlParameter"
when(httpRequest.getParameter("$urlParameter")).thenReturn(null);
#foreach($p in $params)#if($p != $urlParameter)
when(httpRequest.getParameter("$p")).thenReturn("aValue$velocityCount");
when(httpRequest.getParameter("$p")).thenReturn("aValue$foreach.count");
#end#end

// When "Invoking the REST API"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class IndexTest {
#if( $nbParams != 0 ) // Simulate a request with a value for each parameter #end
#foreach($urlParameter in $params)
every { httpRequest.getParameter("$urlParameter") } returns "aValue$velocityCount";
every { httpRequest.getParameter("$urlParameter") } returns "aValue$foreach.count";
#end
// When
Expand All @@ -59,7 +59,7 @@ class IndexTest {
// Validate returned response
assertThat(apiResponse.httpStatus).isEqualTo(200)
#foreach($urlParameter in $params)
assertThat(jsonResponse["$urlParameter"]).isEqualTo("aValue$velocityCount")
assertThat(jsonResponse["$urlParameter"]).isEqualTo("aValue$foreach.count")
#end
assertThat(jsonResponse["myParameterKey"]).isEqualTo("testValue")
assertThat(jsonResponse["currentDate"]).isEqualTo(LocalDate.now().toString())
Expand All @@ -73,7 +73,7 @@ class IndexTest {
#if( $nbParams != 0 ) // Other parameters return a valid value #end
#foreach($p in $params)#if($p != $urlParameter)
every { httpRequest.getParameter("$p") } returns "aValue$velocityCount";
every { httpRequest.getParameter("$p") } returns "aValue$foreach.count";
#end#end
// When
Expand Down

0 comments on commit 156c376

Please sign in to comment.