DATACMNS-446 - Added toString() methods to TypeInformation types.

This commit is contained in:
Oliver Gierke
2014-02-23 13:37:08 +01:00
parent 71169ca160
commit ab37869a1a
8 changed files with 76 additions and 8 deletions

View File

@@ -317,6 +317,16 @@ public class ClassTypeInformationUnitTests {
assertThat(nestedValueType.getComponentType().getType(), is((Object) Person.class));
}
/**
* @see DATACMNS-446
*/
@Test
public void createsToStringRepresentation() {
assertThat(from(SpecialPerson.class).toString(),
is("org.springframework.data.util.ClassTypeInformationUnitTests$SpecialPerson"));
}
static class StringMapContainer extends MapContainer<String> {
}

View File

@@ -18,6 +18,7 @@ package org.springframework.data.util;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.springframework.data.util.ClassTypeInformation.*;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
@@ -38,8 +39,7 @@ import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class ParameterizedTypeUnitTests {
@Mock
ParameterizedType one;
@Mock ParameterizedType one;
@Before
public void setUp() {
@@ -85,6 +85,16 @@ public class ParameterizedTypeUnitTests {
assertThat(propertyType.getMapValueType().getType(), is(typeCompatibleWith(Locale.class)));
}
/**
* @see DATACMNS-446
*/
@Test
public void createsToStringRepresentation() {
assertThat(from(Foo.class).getProperty("param").toString(),
is("org.springframework.data.util.ParameterizedTypeUnitTests$Localized<java.lang.String>"));
}
@SuppressWarnings("serial")
class Localized<S> extends HashMap<Locale, S> {
S value;