Upgrade pojo sample to Boot 2.0 as integration test

This commit is contained in:
Dave Syer
2018-03-15 06:45:58 -04:00
parent 740a94b202
commit 9a2f21e051
4 changed files with 12 additions and 5 deletions

View File

@@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<version>2.0.0.RELEASE</version>
<relativePath/>
</parent>

View File

@@ -1,3 +1,3 @@
boms.spring-cloud-dependencies: org.springframework.cloud:spring-cloud-dependencies:Edgware.RELEASE
boms.spring-cloud-dependencies: org.springframework.cloud:spring-cloud-dependencies:Finchley.M8
dependencies.spring-cloud-function-stream: org.springframework.cloud:spring-cloud-function-stream
dependencies.spring-cloud-stream-rabbit: org.springframework.cloud:spring-cloud-starter-stream-rabbit

View File

@@ -18,10 +18,10 @@ package com.example;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -46,12 +46,19 @@ public class SampleApplicationTests {
@Test
public void uppercase() {
// TODO: make this work with a JSON stream as well (like in WebFlux)
assertThat(new TestRestTemplate().postForObject(
"http://localhost:" + port + "/uppercase", "[{\"value\":\"foo\"}]",
String.class)).isEqualTo("[{\"value\":\"FOO\"}]");
}
@Test
public void single() {
// TODO: make this return a single value
assertThat(new TestRestTemplate().postForObject(
"http://localhost:" + port + "/uppercase", "{\"value\":\"foo\"}",
String.class)).isEqualTo("[{\"value\":\"FOO\"}]");
}
@Test
public void lowercase() {
assertThat(new TestRestTemplate().postForObject(