Add Encoder constructor to HttpMessageConverterView
This commit is contained in:
@@ -18,7 +18,6 @@ package org.springframework.web.reactive;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -30,7 +29,6 @@ import reactor.core.util.SignalKind;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.codec.support.StringDecoder;
|
||||
import org.springframework.core.codec.support.StringEncoder;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
@@ -63,7 +61,9 @@ import org.springframework.web.server.handler.FilteringWebHandler;
|
||||
import org.springframework.web.server.session.WebSessionManager;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.startsWith;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,12 +35,9 @@ import org.springframework.core.codec.support.JacksonJsonEncoder;
|
||||
import org.springframework.core.codec.support.Jaxb2Encoder;
|
||||
import org.springframework.core.codec.support.Pojo;
|
||||
import org.springframework.core.codec.support.StringEncoder;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.support.DataBufferTestUtils;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.reactive.CodecHttpMessageConverter;
|
||||
import org.springframework.http.converter.reactive.HttpMessageConverter;
|
||||
import org.springframework.http.server.reactive.MockServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.MockServerHttpResponse;
|
||||
import org.springframework.ui.ExtendedModelMap;
|
||||
@@ -74,8 +71,7 @@ public class HttpMessageConverterViewTests {
|
||||
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
HttpMessageConverter<?> converter = new CodecHttpMessageConverter<>(new JacksonJsonEncoder());
|
||||
this.view = new HttpMessageConverterView(converter);
|
||||
this.view = new HttpMessageConverterView(new JacksonJsonEncoder());
|
||||
this.model = new ExtendedModelMap();
|
||||
this.result = new HandlerResult(new Object(), null, ResolvableType.NONE, model);
|
||||
}
|
||||
@@ -127,8 +123,7 @@ public class HttpMessageConverterViewTests {
|
||||
|
||||
@Test
|
||||
public void extractObjectMultipleMatchesNotSupported() throws Exception {
|
||||
HttpMessageConverter<?> converter = new CodecHttpMessageConverter<>(new StringEncoder());
|
||||
HttpMessageConverterView view = new HttpMessageConverterView(converter);
|
||||
HttpMessageConverterView view = new HttpMessageConverterView(new StringEncoder());
|
||||
view.setModelKeys(new HashSet<>(Arrays.asList("foo1", "foo2")));
|
||||
this.model.addAttribute("foo1", "bar1");
|
||||
this.model.addAttribute("foo2", "bar2");
|
||||
@@ -145,8 +140,7 @@ public class HttpMessageConverterViewTests {
|
||||
|
||||
@Test
|
||||
public void extractObjectNotSupported() throws Exception {
|
||||
HttpMessageConverter<?> converter = new CodecHttpMessageConverter<>(new Jaxb2Encoder());
|
||||
HttpMessageConverterView view = new HttpMessageConverterView(converter);
|
||||
HttpMessageConverterView view = new HttpMessageConverterView(new Jaxb2Encoder());
|
||||
view.setModelKeys(new HashSet<>(Collections.singletonList("foo1")));
|
||||
this.model.addAttribute("foo1", "bar1");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user