Add proxyTargetBeans = false and fix some tests
This commit is contained in:
committed by
Oleg Zhurakousky
parent
521c6d3397
commit
307292b959
@@ -20,7 +20,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud-function.version>2.2.0.BUILD-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>3.0.0.BUILD-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.17.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -16,33 +16,54 @@
|
||||
|
||||
package com.example;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.asyncDispatch;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@WebMvcTest
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
public class SampleApplicationMvcTests {
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@Test
|
||||
@Ignore("FIXME")
|
||||
public void words() throws Exception {
|
||||
this.mockMvc.perform(get("/words"))
|
||||
.andExpect(content().string("[\"foo\",\"bar\"]"));
|
||||
MvcResult result = this.mockMvc.perform(get("/words")).andReturn();
|
||||
mockMvc.perform(asyncDispatch(result)).andExpect(content().string("[\"foo\",\"bar\"]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uppercase() throws Exception {
|
||||
MvcResult result = this.mockMvc.perform(post("/uppercase").contentType(MediaType.TEXT_PLAIN).content("foo")).andReturn();
|
||||
mockMvc.perform(asyncDispatch(result)).andExpect(content().string("FOO"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lowercase() throws Exception {
|
||||
MvcResult result = this.mockMvc.perform(post("/lowercase").contentType(MediaType.TEXT_PLAIN).content("FOO")).andReturn();
|
||||
mockMvc.perform(asyncDispatch(result)).andExpect(content().string("[\"foo\"]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lowercaseMulti() throws Exception {
|
||||
MvcResult result = this.mockMvc.perform(post("/lowercase").contentType(MediaType.APPLICATION_JSON).content("[\"FOO\"]")).andReturn();
|
||||
mockMvc.perform(asyncDispatch(result)).andExpect(content().string("[\"foo\"]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
|
||||
package com.example;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@@ -124,7 +124,7 @@ public class SampleApplicationTests {
|
||||
@Test
|
||||
public void testCharCounter() {
|
||||
Integer length = this.charCounter.apply("the quick brown fox");
|
||||
assertThat(length).isEqualTo(new Integer(19));
|
||||
assertThat(length).isEqualTo(19);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user