|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -package org.springframework.core.convert.support; |
| 17 | +package org.springframework.core.convert.converter; |
18 | 18 |
|
19 | 19 | import java.awt.Color; |
20 | 20 | import java.lang.reflect.Method; |
|
49 | 49 | import org.springframework.core.convert.ConversionFailedException; |
50 | 50 | import org.springframework.core.convert.ConverterNotFoundException; |
51 | 51 | import org.springframework.core.convert.TypeDescriptor; |
52 | | -import org.springframework.core.convert.converter.Converter; |
53 | | -import org.springframework.core.convert.converter.ConverterRegistry; |
| 52 | +import org.springframework.core.convert.support.DefaultConversionService; |
54 | 53 | import org.springframework.tests.Assume; |
55 | 54 | import org.springframework.tests.TestGroup; |
56 | 55 | import org.springframework.util.ClassUtils; |
|
60 | 59 | import static org.junit.Assert.*; |
61 | 60 |
|
62 | 61 | /** |
63 | | - * Unit tests for the {@link DefaultConversionService}. |
| 62 | + * Unit tests for {@link DefaultConversionService}. |
64 | 63 | * |
65 | | - * <p>For tests involving the {@link GenericConversionService}, see |
66 | | - * {@link GenericConversionServiceTests}. |
| 64 | + * <p>In this package for enforcing accessibility checks to non-public classes outside |
| 65 | + * of the {@code org.springframework.core.convert.support} implementation package. |
| 66 | + * Only in such a scenario, {@code setAccessible(true)} is actually necessary. |
67 | 67 | * |
68 | 68 | * @author Keith Donald |
69 | 69 | * @author Juergen Hoeller |
70 | 70 | * @author Stephane Nicoll |
71 | 71 | * @author Sam Brannen |
72 | | - * @see GenericConversionServiceTests |
73 | 72 | */ |
74 | 73 | public class DefaultConversionServiceTests { |
75 | 74 |
|
@@ -243,22 +242,22 @@ public void testStringToEnumEmptyString() { |
243 | 242 | public void testEnumToString() { |
244 | 243 | assertEquals("BAR", conversionService.convert(Foo.BAR, String.class)); |
245 | 244 | } |
246 | | - |
| 245 | + |
247 | 246 | @Test |
248 | 247 | public void testIntegerToEnum() throws Exception { |
249 | 248 | assertEquals(Foo.BAR, conversionService.convert(0, Foo.class)); |
250 | 249 | } |
251 | | - |
| 250 | + |
252 | 251 | @Test |
253 | 252 | public void testIntegerToEnumWithSubclass() throws Exception { |
254 | 253 | assertEquals(SubFoo.BAZ, conversionService.convert(1, SubFoo.BAR.getClass())); |
255 | 254 | } |
256 | | - |
| 255 | + |
257 | 256 | @Test |
258 | 257 | public void testIntegerToEnumNull() { |
259 | 258 | assertEquals(null, conversionService.convert(null, Foo.class)); |
260 | 259 | } |
261 | | - |
| 260 | + |
262 | 261 | @Test |
263 | 262 | public void testEnumToInteger() { |
264 | 263 | assertEquals(Integer.valueOf(0), conversionService.convert(Foo.BAR, Integer.class)); |
|
0 commit comments