|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
|
* Copyright 2002-2020 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. |
|
|
|
|
@ -51,13 +51,10 @@ import org.springframework.core.convert.ConversionFailedException;
@@ -51,13 +51,10 @@ import org.springframework.core.convert.ConversionFailedException;
|
|
|
|
|
import org.springframework.core.convert.ConverterNotFoundException; |
|
|
|
|
import org.springframework.core.convert.TypeDescriptor; |
|
|
|
|
import org.springframework.core.convert.support.DefaultConversionService; |
|
|
|
|
import org.springframework.core.testfixture.EnabledForTestGroups; |
|
|
|
|
import org.springframework.util.ClassUtils; |
|
|
|
|
import org.springframework.util.StopWatch; |
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; |
|
|
|
|
import static org.springframework.core.testfixture.TestGroup.PERFORMANCE; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Unit tests for {@link DefaultConversionService}. |
|
|
|
|
@ -965,23 +962,6 @@ class DefaultConversionServiceTests {
@@ -965,23 +962,6 @@ class DefaultConversionServiceTests {
|
|
|
|
|
assertThat((Object) conversionService.convert(Optional.empty(), Optional.class)).isSameAs(Optional.empty()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
@EnabledForTestGroups(PERFORMANCE) |
|
|
|
|
void testPerformance1() { |
|
|
|
|
StopWatch watch = new StopWatch("integer->string conversionPerformance"); |
|
|
|
|
watch.start("convert 4,000,000 with conversion service"); |
|
|
|
|
for (int i = 0; i < 4000000; i++) { |
|
|
|
|
conversionService.convert(3, String.class); |
|
|
|
|
} |
|
|
|
|
watch.stop(); |
|
|
|
|
watch.start("convert 4,000,000 manually"); |
|
|
|
|
for (int i = 0; i < 4000000; i++) { |
|
|
|
|
Integer.valueOf(3).toString(); |
|
|
|
|
} |
|
|
|
|
watch.stop(); |
|
|
|
|
// System.out.println(watch.prettyPrint());
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// test fields and helpers
|
|
|
|
|
|
|
|
|
|
|