Skip to content

Commit 2dacbee

Browse files
committed
Add testSinglePojoRequestPart
1 parent 2ec01b1 commit 2dacbee

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

spring-cloud-openfeign-core/src/test/java/org/springframework/cloud/openfeign/valid/FeignClientTests.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@ public void testSingleRequestPart() {
452452
assertThat(response).isEqualTo("abc");
453453
}
454454

455+
@Test
456+
public void testSinglePojoRequestPart() {
457+
String response = this.multipartClient.singlePojoPart(new Hello(HELLO_WORLD_1));
458+
assertThat(response).isEqualTo(HELLO_WORLD_1);
459+
}
460+
455461
@Test
456462
public void testMultipleRequestParts() {
457463
MockMultipartFile file = new MockMultipartFile("file", "hello.bin", null,
@@ -683,6 +689,11 @@ protected interface MultipartClient {
683689
produces = MediaType.TEXT_PLAIN_VALUE)
684690
String singlePart(@RequestPart("hello") String hello);
685691

692+
@RequestMapping(method = RequestMethod.POST, path = "/singlePojoPart",
693+
consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
694+
produces = MediaType.TEXT_PLAIN_VALUE)
695+
String singlePojoPart(@RequestPart("hello") Hello hello);
696+
686697
@RequestMapping(method = RequestMethod.POST, path = "/multipart",
687698
consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
688699
produces = MediaType.TEXT_PLAIN_VALUE)
@@ -1053,10 +1064,17 @@ Collection<String> getToString(@RequestParam("arg") Collection<OtherArg> args) {
10531064
@RequestMapping(method = RequestMethod.POST, path = "/singlePart",
10541065
consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
10551066
produces = MediaType.TEXT_PLAIN_VALUE)
1056-
String multipart(@RequestPart("hello") String hello) {
1067+
String singlePart(@RequestPart("hello") String hello) {
10571068
return hello;
10581069
}
10591070

1071+
@RequestMapping(method = RequestMethod.POST, path = "/singlePojoPart",
1072+
consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
1073+
produces = MediaType.TEXT_PLAIN_VALUE)
1074+
String singlePojoPart(@RequestPart("hello") Hello hello) {
1075+
return hello.getMessage();
1076+
}
1077+
10601078
@RequestMapping(method = RequestMethod.POST, path = "/multipart",
10611079
consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
10621080
produces = MediaType.TEXT_PLAIN_VALUE)

0 commit comments

Comments
 (0)