Skip to content

Commit 5313c47

Browse files
committed
update tests after solving conflicts
1 parent 21f0e3d commit 5313c47

3 files changed

Lines changed: 24 additions & 22 deletions

File tree

core-tests/e2e-tests/spring/spring-rest-openapi-v2/src/main/java/com/foo/rest/examples/spring/endpointfocusandprefix/EndpointFocusAndPrefixRest.java

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.springframework.web.bind.annotation.RequestMethod;
1010
import org.springframework.web.bind.annotation.PathVariable;
1111
import org.springframework.web.bind.annotation.RequestBody;
12+
import org.springframework.web.util.HtmlUtils;
1213

1314
import javax.ws.rs.core.MediaType;
1415
import java.util.Arrays;
@@ -29,8 +30,8 @@ public class EndpointFocusAndPrefixRest {
2930
produces = MediaType.APPLICATION_JSON
3031
)
3132
public String getPetById( @ApiParam("Value to retrieve")
32-
@PathVariable("petId")
33-
Integer value) {
33+
@PathVariable("petId")
34+
Integer value) {
3435
return value + " retrieved";
3536
}
3637

@@ -41,8 +42,8 @@ public String getPetById( @ApiParam("Value to retrieve")
4142
produces = MediaType.APPLICATION_JSON
4243
)
4344
public String updatePetById( @ApiParam("Value to store")
44-
@PathVariable("petId")
45-
Integer value) {
45+
@PathVariable("petId")
46+
Integer value) {
4647
return value + " updated";
4748
}
4849

@@ -53,8 +54,8 @@ public String updatePetById( @ApiParam("Value to store")
5354
produces = MediaType.APPLICATION_JSON
5455
)
5556
public String deletePetById( @ApiParam("Value to delete")
56-
@PathVariable("petId")
57-
Integer value) {
57+
@PathVariable("petId")
58+
Integer value) {
5859
return value + " deleted";
5960
}
6061

@@ -65,8 +66,8 @@ public String deletePetById( @ApiParam("Value to delete")
6566
produces = MediaType.APPLICATION_JSON
6667
)
6768
public String uploadImageForPet( @ApiParam("Pet ID to upload")
68-
@PathVariable("petId")
69-
Integer value) {
69+
@PathVariable("petId")
70+
Integer value) {
7071
return "Image uploaded for the pet: " + value;
7172
}
7273

@@ -118,8 +119,8 @@ public List<String> getStoreInventory() {
118119
produces = MediaType.APPLICATION_JSON
119120
)
120121
public String findStoreOrderById( @ApiParam("order ID to check")
121-
@PathVariable("orderID")
122-
Integer value) {
122+
@PathVariable("orderID")
123+
Integer value) {
123124
return "Information for the order: " + value;
124125
}
125126

@@ -130,8 +131,8 @@ public String findStoreOrderById( @ApiParam("order ID to check")
130131
produces = MediaType.APPLICATION_JSON
131132
)
132133
public String deleteStoreOrderById( @ApiParam("order ID to check")
133-
@PathVariable("orderID")
134-
Integer value) {
134+
@PathVariable("orderID")
135+
Integer value) {
135136
return "Deleted the order: " + value;
136137
}
137138

@@ -154,7 +155,7 @@ public String placeOrder() {
154155
public String getUserByName( @ApiParam("username to retrieve")
155156
@PathVariable("username")
156157
String name) {
157-
return "Retrieved information for the user " + name;
158+
return "Retrieved information for the user " + HtmlUtils.htmlEscape(String.valueOf(name));
158159
}
159160

160161
@ApiOperation("Update information about a user")
@@ -167,7 +168,7 @@ public String updateUserInformation(
167168
@ApiParam("username to update")
168169
@PathVariable("username")
169170
String name) {
170-
return "Updated information for the user " + name;
171+
return "Updated information for the user " + HtmlUtils.htmlEscape(String.valueOf(name));
171172
}
172173

173174
@ApiOperation("Delete information about a user")
@@ -180,7 +181,7 @@ public String deleteUserInformation(
180181
@ApiParam("username to delete")
181182
@PathVariable("username")
182183
String name) {
183-
return "Deleted information for the user " + name;
184+
return "Deleted information for the user " + HtmlUtils.htmlEscape(String.valueOf(name));
184185
}
185186

186187
@ApiOperation("Create a new user")
@@ -207,10 +208,10 @@ public String createUserWithList(
207208
for(EndpointFocusAndPrefixRestDTO dto : userlist) {
208209

209210
reportBuilder.append("-------\n");
210-
reportBuilder.append("ID: ").append(dto.id).append("\n");
211-
reportBuilder.append("Username: ").append(dto.userName).append("\n");
212-
reportBuilder.append("Firstname: ").append(dto.firstName).append("\n");
213-
reportBuilder.append("Lastname: ").append(dto.lastName).append("\n");
211+
reportBuilder.append("ID: ").append(HtmlUtils.htmlEscape(String.valueOf(dto.id))).append("\n");
212+
reportBuilder.append("Username: ").append(HtmlUtils.htmlEscape(dto.userName)).append("\n");
213+
reportBuilder.append("Firstname: ").append(HtmlUtils.htmlEscape(dto.firstName)).append("\n");
214+
reportBuilder.append("Lastname: ").append(HtmlUtils.htmlEscape(dto.lastName)).append("\n");
214215
reportBuilder.append("-------\n");
215216
}
216217
String report = reportBuilder.toString();
@@ -241,4 +242,4 @@ public String userLogout() {
241242

242243
return "Logged out a user";
243244
}
244-
}
245+
}

core-tests/e2e-tests/spring/spring-rest-openapi-v2/src/test/java/org/evomaster/e2etests/spring/examples/endpointfocusandprefix/EndpointFocusAndPrefixTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public void testRunBlackboxWithPrefixWithoutParameters() throws Throwable {
255255
assertAllSolutionsHavePathFocusOrPrefixList(solution, pathsToCheck, false);
256256

257257
// The solution should include 8 solutions, 7 endpoints and 1 failure case
258-
assertEquals(solution.getIndividuals().size(), 8);
258+
assertEquals(8, solution.getIndividuals().size());
259259

260260
// write test into the output folder
261261
compile(outputFolder);

core-tests/e2e-tests/spring/spring-rest-openapi-v3/src/test/kotlin/org/evomaster/e2etests/spring/openapi/v3/sleep/SleepEMTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class SleepEMTest : SpringTestBase() {
4141
assertTrue(solution.individuals.size >= 1)
4242

4343
//minimization re-execute the test
44-
assertEquals(iterations+1, SleepCounter.counter.get())
44+
val n = SleepCounter.counter.get()
45+
assertTrue(n > iterations, "Times n=$n of calls should be more than i=$iterations iterations")
4546
}
4647
}
4748

0 commit comments

Comments
 (0)