ResolvableType.getType() returns ParameterizedType when built with forClassWithGenerics

Issue: SPR-12701
This commit is contained in:
Juergen Hoeller
2015-02-20 21:53:44 +01:00
parent e3d1a1dda2
commit 91a0107e4a
2 changed files with 58 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@ import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.Callable;
import org.hamcrest.Matchers;
import org.junit.Rule;
@@ -1210,6 +1211,16 @@ public class ResolvableTypeTests {
assertEquals("java.util.Collection<org.springframework.core.ResolvableTypeTests$IBase<?>>", type.toString());
}
@Test
public void testSpr12701() throws Exception {
ResolvableType resolvableType = ResolvableType.forClassWithGenerics(Callable.class, String.class);
Type type = resolvableType.getType();
assertThat(type, is(instanceOf(ParameterizedType.class)));
assertThat(((ParameterizedType) type).getRawType(), is(equalTo(Callable.class)));
assertThat(((ParameterizedType) type).getActualTypeArguments().length, is(equalTo(1)));
assertThat(((ParameterizedType) type).getActualTypeArguments()[0], is(equalTo(String.class)));
}
private ResolvableType testSerialization(ResolvableType type) throws Exception {
ByteArrayOutputStream bos = new ByteArrayOutputStream();