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

@@ -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(