Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions spring-data-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jmolecules.integrations</groupId>
<artifactId>jmolecules-spring</artifactId>
<version>${jmolecules-integration}</version>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ public JdbcCustomConversions(ConverterConfiguration converterConfiguration) {

private static boolean isDateTimeApiConversion(ConvertiblePair cp) {

if (cp.getSourceType().equals(java.util.Date.class) && cp.getTargetType().getTypeName().startsWith("java.time.")) {
return true;
if (cp.getSourceType().equals(java.util.Date.class)) {
return cp.getTargetType().getTypeName().startsWith("java.time.");
}

if (cp.getTargetType().equals(java.util.Date.class) && cp.getSourceType().getTypeName().startsWith("java.time.")) {
return true;
if (cp.getTargetType().equals(java.util.Date.class)) {
return cp.getSourceType().getTypeName().startsWith("java.time.");
}

return false;
return true;
}
}
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));
}
}