SPR-6771 - HttpMessageConverter should accept Class<? extends T> on can read

This commit is contained in:
Arjen Poutsma
2010-01-28 09:23:34 +00:00
parent 1cda8cb6fa
commit f2fdf9fa6b
11 changed files with 18 additions and 20 deletions

View File

@@ -43,14 +43,14 @@ public class FormHttpMessageConverterTests {
@Test
@SuppressWarnings("unchecked")
public void canRead() {
assertTrue(converter.canRead((Class<? extends MultiValueMap<String, String>>) MultiValueMap.class, new MediaType("application", "x-www-form-urlencoded")));
assertTrue(converter.canRead(MultiValueMap.class, new MediaType("application", "x-www-form-urlencoded")));
}
@Test
@SuppressWarnings("unchecked")
public void canWrite() {
assertTrue(converter.canWrite((Class<? extends MultiValueMap<String, String>>) MultiValueMap.class, new MediaType("application", "x-www-form-urlencoded")));
assertTrue(converter.canWrite((Class<? extends MultiValueMap<String, String>>) MultiValueMap.class, MediaType.ALL));
assertTrue(converter.canWrite(MultiValueMap.class, new MediaType("application", "x-www-form-urlencoded")));
assertTrue(converter.canWrite(MultiValueMap.class, MediaType.ALL));
}
@SuppressWarnings("unchecked")

View File

@@ -39,7 +39,7 @@ public class HttpMessageConverterTests {
public void canRead() {
AbstractHttpMessageConverter<MyType> converter = new MyHttpMessageConverter<MyType>(MEDIA_TYPE) {
@Override
protected boolean supports(Class<? extends MyType> clazz) {
protected boolean supports(Class<?> clazz) {
return MyType.class.equals(clazz);
}
@@ -54,7 +54,7 @@ public class HttpMessageConverterTests {
public void canWrite() {
AbstractHttpMessageConverter<MyType> converter = new MyHttpMessageConverter<MyType>(MEDIA_TYPE) {
@Override
protected boolean supports(Class<? extends MyType> clazz) {
protected boolean supports(Class<?> clazz) {
return MyType.class.equals(clazz);
}
@@ -73,7 +73,7 @@ public class HttpMessageConverterTests {
}
@Override
protected boolean supports(Class<? extends T> clazz) {
protected boolean supports(Class<?> clazz) {
fail("Not expected");
return false;
}

View File

@@ -43,15 +43,12 @@ public class Jaxb2RootElementHttpMessageConverterTest {
private RootElement rootElement;
private Type type;
private RootElement rootElementCglib;
@Before
public void setUp() {
converter = new Jaxb2RootElementHttpMessageConverter();
rootElement = new RootElement();
type = new Type();
DefaultAopProxyFactory proxyFactory = new DefaultAopProxyFactory();
AdvisedSupport advisedSupport = new AdvisedSupport();
advisedSupport.setTarget(rootElement);