Add StringToUUIDConverter
Conversion to and from UUID objects is now supported by the DefaultConversionService. Issue: SPR-9765
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.core.convert.support;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
@@ -36,8 +36,8 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.core.convert.ConversionFailedException;
|
||||
import org.springframework.core.convert.ConverterNotFoundException;
|
||||
@@ -382,6 +382,15 @@ public class GenericConversionServiceTests {
|
||||
assertSame(value, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertUUID() throws Exception {
|
||||
GenericConversionService service = new DefaultConversionService();
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String convertToString = service.convert(uuid, String.class);
|
||||
UUID convertToUUID = service.convert(convertToString, UUID.class);
|
||||
assertEquals(uuid, convertToUUID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPerformance1() {
|
||||
GenericConversionService conversionService = new DefaultConversionService();
|
||||
|
||||
Reference in New Issue
Block a user