Skip to content

Commit 71396db

Browse files
GH-2384 - Reduce URL comparison down to just the host name.
This fixes #2384.
1 parent 031c8a6 commit 71396db

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/test/java/org/springframework/data/neo4j/integration/conversion_imperative/TypeConversionIT.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import static org.assertj.core.api.Assertions.assertThat;
1919
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
2020

21+
import java.net.URL;
2122
import java.text.SimpleDateFormat;
2223
import java.time.ZoneId;
2324
import java.time.ZonedDateTime;
@@ -57,13 +58,13 @@
5758
import org.springframework.data.neo4j.core.transaction.Neo4jBookmarkManager;
5859
import org.springframework.data.neo4j.core.transaction.Neo4jTransactionManager;
5960
import org.springframework.data.neo4j.integration.shared.common.AllArgsCtorNoBuilder;
61+
import org.springframework.data.neo4j.integration.shared.common.ThingWithAllCypherTypes;
6062
import org.springframework.data.neo4j.integration.shared.common.ThingWithAllCypherTypes2;
63+
import org.springframework.data.neo4j.integration.shared.common.ThingWithAllSpatialTypes;
64+
import org.springframework.data.neo4j.integration.shared.common.ThingWithUUIDID;
6165
import org.springframework.data.neo4j.integration.shared.conversion.Neo4jConversionsITBase;
6266
import org.springframework.data.neo4j.integration.shared.conversion.ThingWithAllAdditionalTypes;
63-
import org.springframework.data.neo4j.integration.shared.common.ThingWithAllCypherTypes;
64-
import org.springframework.data.neo4j.integration.shared.common.ThingWithAllSpatialTypes;
6567
import org.springframework.data.neo4j.integration.shared.conversion.ThingWithCustomTypes;
66-
import org.springframework.data.neo4j.integration.shared.common.ThingWithUUIDID;
6768
import org.springframework.data.neo4j.repository.Neo4jRepository;
6869
import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
6970
import org.springframework.data.neo4j.test.BookmarkCapture;
@@ -160,8 +161,17 @@ Stream<DynamicNode> conversionsShouldBeAppliedToEntities() {
160161

161162
DynamicContainer reads = DynamicContainer.dynamicContainer("read",
162163
entry.getValue().entrySet().stream().map(a -> DynamicTest.dynamicTest(a.getKey(),
163-
() -> assertThat(ReflectionTestUtils.getField(thing, a.getKey()))
164-
.isEqualTo(a.getValue()))));
164+
() -> {
165+
Object actual = ReflectionTestUtils.getField(thing, a.getKey());
166+
Object expected = a.getValue();
167+
if (actual instanceof URL && expected instanceof URL) {
168+
// The host has been chosen to avoid interaction with the URLStreamHandler
169+
// Should be enough for our comparision.
170+
actual = ((URL) actual).getHost();
171+
expected = ((URL) expected).getHost();
172+
}
173+
assertThat(actual).isEqualTo(expected);
174+
})));
165175

166176
DynamicContainer writes = DynamicContainer.dynamicContainer("write", entry.getValue().keySet().stream()
167177
.map(o -> DynamicTest

0 commit comments

Comments
 (0)