Skip to content

Commit b3f2ac3

Browse files
committed
ACC-2100 use '%n' as newline instead of '\n'
1 parent f9341e3 commit b3f2ac3

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

contentgrid-appserver-rest/src/test/java/com/contentgrid/appserver/rest/RelationRestControllerTest.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void setOneToOneRelation() throws Exception {
162162

163163
mockMvc.perform(put("/invoices/{sourceId}/previous-invoice", INVOICE_ID)
164164
.contentType("text/uri-list")
165-
.content("http://localhost/invoices/%s\n".formatted(targetId)))
165+
.content("http://localhost/invoices/%s%n".formatted(targetId)))
166166
.andExpect(status().isNoContent());
167167

168168
Mockito.verify(datamodelApi).setRelation(TestApplication.APPLICATION, XToOneRelationData.builder()
@@ -178,7 +178,7 @@ void setManyToOneRelation() throws Exception {
178178

179179
mockMvc.perform(put("/invoices/{sourceId}/customer", INVOICE_ID)
180180
.contentType("text/uri-list")
181-
.content("http://localhost/persons/%s\n".formatted(targetId)))
181+
.content("http://localhost/persons/%s%n".formatted(targetId)))
182182
.andExpect(status().isNoContent());
183183

184184
Mockito.verify(datamodelApi).setRelation(TestApplication.APPLICATION, XToOneRelationData.builder()
@@ -231,7 +231,7 @@ void addOneToManyRelationData() throws Exception {
231231

232232
mockMvc.perform(post("/persons/{sourceId}/invoices", PERSON_ID)
233233
.contentType("text/uri-list")
234-
.content("http://localhost/invoices/%s\nhttp://localhost/invoices/%s\n".formatted(invoice1,
234+
.content("http://localhost/invoices/%s%nhttp://localhost/invoices/%s%n".formatted(invoice1,
235235
invoice2)))
236236
.andExpect(status().isNoContent());
237237

@@ -250,7 +250,7 @@ void addManyToManyRelationData() throws Exception {
250250

251251
mockMvc.perform(post("/products/{sourceId}/invoices", PRODUCT_ID)
252252
.contentType("text/uri-list")
253-
.content("http://localhost/invoices/%s\nhttp://localhost/invoices/%s\n".formatted(invoice1,
253+
.content("http://localhost/invoices/%s%nhttp://localhost/invoices/%s%n".formatted(invoice1,
254254
invoice2)))
255255
.andExpect(status().isNoContent());
256256

@@ -289,10 +289,10 @@ class InvalidInput {
289289
static Stream<String> invalidUrls() {
290290
var targetId = EntityId.of(UUID.randomUUID());
291291
return Stream.of(
292-
"http://localhost/persons/%s\n".formatted(targetId), // person instead of invoice
293-
"http://localhost/invoices\n", // collection url
294-
"http://localhost/invoices/%s/next-invoice\n".formatted(targetId), // relation url
295-
"}%s\n".formatted(targetId) // illegal url
292+
"http://localhost/persons/%s%n".formatted(targetId), // person instead of invoice
293+
"http://localhost/invoices%n", // collection url
294+
"http://localhost/invoices/%s/next-invoice%n".formatted(targetId), // relation url
295+
"}%s%n".formatted(targetId) // illegal url
296296
);
297297
}
298298

@@ -310,7 +310,7 @@ void followRelationInvalidUrl(String url) throws Exception {
310310
void setRelationNoData() throws Exception {
311311
mockMvc.perform(put("/invoices/{sourceId}/previous-invoice", INVOICE_ID)
312312
.contentType("text/uri-list")
313-
.content("\n"))
313+
.content("%n"))
314314
.andExpect(status().isBadRequest());
315315
}
316316

@@ -321,7 +321,7 @@ void setRelationTooManyData() throws Exception {
321321

322322
mockMvc.perform(put("/invoices/{sourceId}/previous-invoice", INVOICE_ID)
323323
.contentType("text/uri-list")
324-
.content("http://localhost/invoices/%s\nhttp://localhost/invoices/%s\n".formatted(target1, target2)))
324+
.content("http://localhost/invoices/%s%nhttp://localhost/invoices/%s%n".formatted(target1, target2)))
325325
.andExpect(status().isBadRequest());
326326
}
327327

@@ -331,7 +331,7 @@ void setRelationToManyRelation() throws Exception {
331331

332332
mockMvc.perform(put("/persons/{sourceId}/invoices", PERSON_ID) // one-to-many
333333
.contentType("text/uri-list")
334-
.content("http://localhost/invoices/%s\n".formatted(targetId)))
334+
.content("http://localhost/invoices/%s%n".formatted(targetId)))
335335
.andExpect(status().isBadRequest());
336336
}
337337

@@ -348,7 +348,7 @@ void setRelationInvalidUrl(String url) throws Exception {
348348
void addRelationNoData() throws Exception {
349349
mockMvc.perform(post("/persons/{sourceId}/invoices", PERSON_ID)
350350
.contentType("text/uri-list")
351-
.content("\n"))
351+
.content("%n"))
352352
.andExpect(status().isBadRequest());
353353
}
354354

@@ -358,7 +358,7 @@ void addRelationToOneRelation() throws Exception {
358358

359359
mockMvc.perform(post("/invoices/{sourceId}/previous-invoice", INVOICE_ID) // one-to-one
360360
.contentType("text/uri-list")
361-
.content("http://localhost/invoices/%s\n".formatted(targetId)))
361+
.content("http://localhost/invoices/%s%n".formatted(targetId)))
362362
.andExpect(status().isBadRequest());
363363
}
364364

@@ -428,7 +428,7 @@ void setRelationEntityIdNotFound() throws Exception {
428428

429429
mockMvc.perform(put("/invoices/{sourceId}/previous-invoice", INVOICE_ID)
430430
.contentType("text/uri-list")
431-
.content("http://localhost/invoices/%s\n".formatted(targetId)))
431+
.content("http://localhost/invoices/%s%n".formatted(targetId)))
432432
.andExpect(status().isNotFound());
433433
}
434434

@@ -445,7 +445,7 @@ void setRelationForeignKeyConstraintViolation() throws Exception {
445445

446446
mockMvc.perform(put("/invoices/{sourceId}/previous-invoice", INVOICE_ID)
447447
.contentType("text/uri-list")
448-
.content("http://localhost/invoices/%s\n".formatted(targetId)))
448+
.content("http://localhost/invoices/%s%n".formatted(targetId)))
449449
.andExpect(status().isBadRequest());
450450
}
451451

@@ -464,7 +464,7 @@ void addRelationEntityIdNotFound() throws Exception {
464464

465465
mockMvc.perform(post("/persons/{sourceId}/invoices", PERSON_ID)
466466
.contentType("text/uri-list")
467-
.content("http://localhost/invoices/%s\nhttp://localhost/invoices/%s\n".formatted(invoice1,
467+
.content("http://localhost/invoices/%s%nhttp://localhost/invoices/%s%n".formatted(invoice1,
468468
invoice2)))
469469
.andExpect(status().isNotFound());
470470
}
@@ -484,7 +484,7 @@ void addRelationForeignKeyConstraintViolation() throws Exception {
484484

485485
mockMvc.perform(post("/persons/{sourceId}/invoices", PERSON_ID)
486486
.contentType("text/uri-list")
487-
.content("http://localhost/invoices/%s\nhttp://localhost/invoices/%s\n".formatted(invoice1,
487+
.content("http://localhost/invoices/%s%nhttp://localhost/invoices/%s%n".formatted(invoice1,
488488
invoice2)))
489489
.andExpect(status().isBadRequest());
490490
}

0 commit comments

Comments
 (0)