DATAJDBC-355 - Remove unnecessary null check.
The source parameter must not be null according to Javadoc of Converter. See also: https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/convert/converter/Converter.html Original pull request: #146.
This commit is contained in:
committed by
Jens Schauder
parent
6f18648412
commit
082eafb62d
@@ -39,7 +39,6 @@ import org.springframework.data.jdbc.core.convert.JdbcValue;
|
|||||||
import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory;
|
import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory;
|
||||||
import org.springframework.data.jdbc.testing.TestConfiguration;
|
import org.springframework.data.jdbc.testing.TestConfiguration;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.lang.Nullable;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.rules.SpringClassRule;
|
import org.springframework.test.context.junit4.rules.SpringClassRule;
|
||||||
import org.springframework.test.context.junit4.rules.SpringMethodRule;
|
import org.springframework.test.context.junit4.rules.SpringMethodRule;
|
||||||
@@ -49,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
* Tests storing and retrieving data types that get processed by custom conversions.
|
* Tests storing and retrieving data types that get processed by custom conversions.
|
||||||
*
|
*
|
||||||
* @author Jens Schauder
|
* @author Jens Schauder
|
||||||
|
* @author Sanghyuk Jung
|
||||||
*/
|
*/
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -93,9 +93,9 @@ public class JdbcRepositoryCustomConversionIntegrationTests {
|
|||||||
*
|
*
|
||||||
* @Override
|
* @Override
|
||||||
* @Nullable
|
* @Nullable
|
||||||
* public BigDecimal convert(@Nullable String source) {
|
* public BigDecimal convert(String source) {
|
||||||
*
|
*
|
||||||
* return source == null ? null : new BigDecimal(source);
|
* return source == new BigDecimal(source);
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
@@ -130,9 +130,9 @@ public class JdbcRepositoryCustomConversionIntegrationTests {
|
|||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JdbcValue convert(@Nullable String source) {
|
public JdbcValue convert(String source) {
|
||||||
|
|
||||||
Object value = source == null ? null : new BigDecimal(source);
|
Object value = new BigDecimal(source);
|
||||||
return JdbcValue.of(value, JDBCType.DECIMAL);
|
return JdbcValue.of(value, JDBCType.DECIMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,11 +144,7 @@ public class JdbcRepositoryCustomConversionIntegrationTests {
|
|||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convert(@Nullable BigDecimal source) {
|
public String convert(BigDecimal source) {
|
||||||
|
|
||||||
if (source == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return source.toString();
|
return source.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user