-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JdbcCustomConversion does not reject non-Date related default convert…
…ers. Previously, JdbcCustomConversion rejected any default converter that was not converting from and to java.util.Date. This probably stemmed from the fact that up until recently, Spring Data Commons' CustomConversions only registered date related default converters. As of spring-projects/spring-data-commons#2315 we also support jMolecules' Association and Identifier converters. We've relaxed the rejection to only explicitly reject all non Date/Time related converters if the conversion is from/to java.util.Date but allow everything else out of the box.
- Loading branch information
Showing
3 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
.../test/java/org/springframework/data/jdbc/core/convert/JdbcCustomConversionsUnitTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2021 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.springframework.data.jdbc.core.convert; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
|
||
import org.jmolecules.ddd.types.Association; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Unit tests for {@link JdbcCustomConversions}. | ||
* | ||
* @author Oliver Drotbohm | ||
*/ | ||
class JdbcCustomConversionsUnitTests { | ||
|
||
@Test // #937 | ||
void registersNonDateDefaultConverter() { | ||
|
||
JdbcCustomConversions conversions = new JdbcCustomConversions(); | ||
|
||
assertThat(conversions.hasCustomWriteTarget(Association.class)).isTrue(); | ||
assertThat(conversions.getSimpleTypeHolder().isSimpleType(Association.class)); | ||
} | ||
} |