From 082eafb62dc2205fec5ee8f61b0c540b7899d00a Mon Sep 17 00:00:00 2001 From: Sanghyuk Jung Date: Fri, 29 Mar 2019 08:45:27 +0900 Subject: [PATCH] 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. --- ...positoryCustomConversionIntegrationTests.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryCustomConversionIntegrationTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryCustomConversionIntegrationTests.java index 2f9c30c4..2ec7b058 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryCustomConversionIntegrationTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryCustomConversionIntegrationTests.java @@ -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.testing.TestConfiguration; import org.springframework.data.repository.CrudRepository; -import org.springframework.lang.Nullable; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; 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. * * @author Jens Schauder + * @author Sanghyuk Jung */ @ContextConfiguration @Transactional @@ -93,9 +93,9 @@ public class JdbcRepositoryCustomConversionIntegrationTests { * * @Override * @Nullable - * public BigDecimal convert(@Nullable String source) { + * public BigDecimal convert(String source) { * - * return source == null ? null : new BigDecimal(source); + * return source == new BigDecimal(source); * } * } * @@ -130,9 +130,9 @@ public class JdbcRepositoryCustomConversionIntegrationTests { INSTANCE; @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); } @@ -144,11 +144,7 @@ public class JdbcRepositoryCustomConversionIntegrationTests { INSTANCE; @Override - public String convert(@Nullable BigDecimal source) { - - if (source == null) { - return null; - } + public String convert(BigDecimal source) { return source.toString(); }