Update POJO sample to use webflux

This commit is contained in:
Dave Syer
2018-10-25 16:35:17 +01:00
parent f5b09e8d27
commit c1bce87771
3 changed files with 17 additions and 2 deletions

View File

@@ -26,7 +26,7 @@
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-function-web</artifactId>
<artifactId>spring-cloud-starter-function-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -86,7 +86,7 @@ public class SampleApplicationTests {
map.put("B", Arrays.asList("5", "6"));
assertThat(new TestRestTemplate().exchange(RequestEntity.post(new URI("http://localhost:" + port + "/sum"))
.accept(MediaType.APPLICATION_JSON).contentType(MediaType.MULTIPART_FORM_DATA)
.accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_FORM_URLENCODED)
.body(map), String.class).getBody())
.isEqualTo("[{\"A\":6,\"B\":11}]");
}

View File

@@ -301,6 +301,21 @@ public class HttpPostIntegrationTests {
String.class).getBody()).isEqualTo("[{\"A\":6,\"B\":11}]");
}
@Test
@Ignore
public void multipart() throws Exception {
LinkedMultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.put("A", Arrays.asList("1", "2", "3"));
map.put("B", Arrays.asList("5", "6"));
assertThat(rest.exchange(
RequestEntity.post(new URI("/sum")).accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.MULTIPART_FORM_DATA).body(map),
String.class).getBody()).isEqualTo("[{\"A\":6,\"B\":11}]");
}
@Test
public void count() throws Exception {
List<String> list = Arrays.asList("A", "B", "A");