diff --git a/src/main/java/org/springframework/data/neo4j/core/ReactiveNeo4jTemplate.java b/src/main/java/org/springframework/data/neo4j/core/ReactiveNeo4jTemplate.java index 657ef65f15..5248889c68 100644 --- a/src/main/java/org/springframework/data/neo4j/core/ReactiveNeo4jTemplate.java +++ b/src/main/java/org/springframework/data/neo4j/core/ReactiveNeo4jTemplate.java @@ -566,7 +566,8 @@ private Mono> determineDynamicLabels(T entityToBeSa .one() .map(m -> (Collection) m.get(Constants.NAME_OF_LABELS)) .switchIfEmpty(Mono.just(Collections.emptyList())) - .zipWith(Mono.just((Collection) propertyAccessor.getProperty(p))) + .zipWith(Mono.just( + (Collection) Objects.requireNonNullElseGet(propertyAccessor.getProperty(p), List::of))) .map(t -> Tuples.of(entityToBeSaved, new DynamicLabels(entityMetaData, t.getT1(), t.getT2()))); }).orElse(Mono.just(Tuples.of(entityToBeSaved, DynamicLabels.EMPTY))); } diff --git a/src/test/kotlin/org/springframework/data/neo4j/integration/reactive/ReactiveNeo4jClientKotlinInteropIT.kt b/src/test/kotlin/org/springframework/data/neo4j/integration/reactive/ReactiveNeo4jClientKotlinInteropIT.kt index f3fb9425e4..028373c819 100644 --- a/src/test/kotlin/org/springframework/data/neo4j/integration/reactive/ReactiveNeo4jClientKotlinInteropIT.kt +++ b/src/test/kotlin/org/springframework/data/neo4j/integration/reactive/ReactiveNeo4jClientKotlinInteropIT.kt @@ -97,7 +97,7 @@ class ReactiveNeo4jClientKotlinInteropIT @Autowired constructor( }.one() StepVerifier.create(queen) - .expectNextMatches { it.name == "Queen" && it.member.size == 4 } + .expectNextMatches { it!!.name == "Queen" && it.member.size == 4 } .verifyComplete() StepVerifier.create(neo4jClient.query("MATCH (n:IDontExists) RETURN id(n)").fetchAs().one())