diff --git a/etc/checkstyle/config.xml b/etc/checkstyle/config.xml
index e48bbf6eb..4fc95089a 100644
--- a/etc/checkstyle/config.xml
+++ b/etc/checkstyle/config.xml
@@ -61,7 +61,7 @@
+ value="^reactor\.core\.support\.Assert, ^org\.junit\.rules\.ExpectedException, ^org\.junit\.Test" />
diff --git a/spring-data-neo4j/pom.xml b/spring-data-neo4j/pom.xml
index a64f7574c..da8b69fad 100644
--- a/spring-data-neo4j/pom.xml
+++ b/spring-data-neo4j/pom.xml
@@ -133,6 +133,12 @@
kotlin-reflect
true
+
+ io.mockk
+ mockk
+ ${mockk}
+ test
+
org.testcontainers
junit-jupiter
diff --git a/spring-data-neo4j/src/main/java/org/neo4j/springframework/data/core/cypher/Conditions.java b/spring-data-neo4j/src/main/java/org/neo4j/springframework/data/core/cypher/Conditions.java
index 896bb5fc7..59858dd91 100644
--- a/spring-data-neo4j/src/main/java/org/neo4j/springframework/data/core/cypher/Conditions.java
+++ b/spring-data-neo4j/src/main/java/org/neo4j/springframework/data/core/cypher/Conditions.java
@@ -188,19 +188,6 @@ public final class Conditions {
return Comparison.create(Operator.IS_NOT_NULL, expression);
}
- /**
- * Creates a condition that checkts whether the expression {@code searchFor} is in the expression {@code in}.
- * {@code in} is supposed to represent a list object.
- *
- * @param searchFor The expression to search for.
- * @param in The expression to search in.
- * @return A new condition.
- */
- static Condition in(Expression searchFor, Expression in) {
-
- return Comparison.create(searchFor, Operator.IN, in);
- }
-
/**
* A condition that evaluates to true if a list or a string represented by {@code expression} is empty or has the length of 0.
*
@@ -223,7 +210,6 @@ public final class Conditions {
return new BooleanFunctionCondition(Functions.exists(expression));
}
-
/**
* Not to be instantiated.
*/
diff --git a/spring-data-neo4j/src/main/java/org/neo4j/springframework/data/core/cypher/Expression.java b/spring-data-neo4j/src/main/java/org/neo4j/springframework/data/core/cypher/Expression.java
index 56fa486d1..633b1c653 100644
--- a/spring-data-neo4j/src/main/java/org/neo4j/springframework/data/core/cypher/Expression.java
+++ b/spring-data-neo4j/src/main/java/org/neo4j/springframework/data/core/cypher/Expression.java
@@ -171,11 +171,11 @@ public interface Expression extends Visitable {
* Creates a {@code IN} operation for this expression and that {@code expression}.
* The expression does not track the condition created here.
*
- * @param expression The expression to search for this expression
+ * @param haystack The expression to search for this expression
* @return A new condition.
*/
- default Condition in(Expression expression) {
- return Conditions.in(this, expression);
+ default Condition in(Expression haystack) {
+ return Comparison.create(this, Operator.IN, haystack);
}
/**
diff --git a/spring-data-neo4j/src/main/kotlin/org/neo4j/springframework/data/core/Neo4jClientExtensions.kt b/spring-data-neo4j/src/main/kotlin/org/neo4j/springframework/data/core/Neo4jClientExtensions.kt
new file mode 100644
index 000000000..53b432672
--- /dev/null
+++ b/spring-data-neo4j/src/main/kotlin/org/neo4j/springframework/data/core/Neo4jClientExtensions.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2019 "Neo4j,"
+ * Neo4j Sweden AB [https://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * 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.neo4j.springframework.data.core
+
+/**
+ * Extension for [Neo4jClient.RunnableSpec.in] providing an `inDatabase` alias since `in` is a reserved keyword in Kotlin.
+ *
+ * @author Michael J. Simons
+ * @since 1.0
+ */
+fun Neo4jClient.RunnableSpec.inDatabase(targetDatabase: String): Neo4jClient.RunnableSpecTightToDatabase = `in`(targetDatabase)
+
+/**
+ * Extension for [Neo4jClient.OngoingDelegation.in] providing an `inDatabase` alias since `in` is a reserved keyword in Kotlin.
+ *
+ * @author Michael J. Simons
+ * @since 1.0
+ */
+fun Neo4jClient.OngoingDelegation.inDatabase(targetDatabase: String): Neo4jClient.RunnableDelegation = `in`(targetDatabase)
diff --git a/spring-data-neo4j/src/main/kotlin/org/neo4j/springframework/data/core/ReactiveNeo4jClientExtensions.kt b/spring-data-neo4j/src/main/kotlin/org/neo4j/springframework/data/core/ReactiveNeo4jClientExtensions.kt
new file mode 100644
index 000000000..a7f1ab6bb
--- /dev/null
+++ b/spring-data-neo4j/src/main/kotlin/org/neo4j/springframework/data/core/ReactiveNeo4jClientExtensions.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2019 "Neo4j,"
+ * Neo4j Sweden AB [https://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * 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.neo4j.springframework.data.core
+
+/**
+ * Extension for [ReactiveNeo4jClient.ReactiveRunnableSpec.in] providing an `inDatabase` alias since `in` is a reserved keyword in Kotlin.
+ *
+ * @author Michael J. Simons
+ * @since 1.0
+ */
+fun ReactiveNeo4jClient.ReactiveRunnableSpec.inDatabase(targetDatabase: String): ReactiveNeo4jClient.ReactiveRunnableSpecTightToDatabase = `in`(targetDatabase)
+
+/**
+ * Extension for [ReactiveNeo4jClient.OngoingReactiveDelegation.in] providing an `inDatabase` alias since `in` is a reserved keyword in Kotlin.
+ *
+ * @author Michael J. Simons
+ * @since 1.0
+ */
+fun ReactiveNeo4jClient.OngoingReactiveDelegation.inDatabase(targetDatabase: String): ReactiveNeo4jClient.ReactiveRunnableDelegation = `in`(targetDatabase)
diff --git a/spring-data-neo4j/src/main/kotlin/org/neo4j/springframework/data/core/cypher/CypherExtensions.kt b/spring-data-neo4j/src/main/kotlin/org/neo4j/springframework/data/core/cypher/CypherExtensions.kt
new file mode 100644
index 000000000..c4a700496
--- /dev/null
+++ b/spring-data-neo4j/src/main/kotlin/org/neo4j/springframework/data/core/cypher/CypherExtensions.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2019 "Neo4j,"
+ * Neo4j Sweden AB [https://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * 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.neo4j.springframework.data.core.cypher
+
+/**
+ * Extension for [Expression.in] providing an `inValues` alias since `in` is a reserved keyword in Kotlin.
+ *
+ * @author Michael J. Simons
+ * @since 1.0
+ */
+fun Expression.inValues(inHaystack: Expression): Condition = `in`(inHaystack)
+
+/**
+ * Extension for [Expression.as] providing an `withAlias` alias since `as` is a reserved keyword in Kotlin.
+ *
+ * @author Michael J. Simons
+ * @since 1.0
+ */
+fun Expression.asAlias(alias: String): AliasedExpression = `as`(alias)
+
+fun StatementBuilder.OngoingUnwind.asAlias(alias: String): StatementBuilder.OngoingReading = `as`(alias)
diff --git a/spring-data-neo4j/src/test/kotlin/org/neo4j/springframework/data/core/Neo4jClientExtensionsTest.kt b/spring-data-neo4j/src/test/kotlin/org/neo4j/springframework/data/core/Neo4jClientExtensionsTest.kt
new file mode 100644
index 000000000..0c84724af
--- /dev/null
+++ b/spring-data-neo4j/src/test/kotlin/org/neo4j/springframework/data/core/Neo4jClientExtensionsTest.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2019 "Neo4j,"
+ * Neo4j Sweden AB [https://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * 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.neo4j.springframework.data.core
+
+import io.mockk.mockk
+import io.mockk.verify
+import org.junit.jupiter.api.Test
+
+/**
+ * @author Michael J. Simons
+ */
+class Neo4jClientExtensionsTest {
+
+ @Test
+ fun `RunnableSpec#inDatabase(targetDatabase) extension should call its Java counterpart`() {
+
+ val runnableSpec = mockk(relaxed = true)
+
+ runnableSpec.inDatabase("foobar");
+
+ verify(exactly = 1) { runnableSpec.`in`("foobar") }
+ }
+
+ @Test
+ fun `OngoingDelegation#inDatabase(targetDatabase) extension should call its Java counterpart`() {
+
+ val ongoingDelegation = mockk>(relaxed = true)
+
+ ongoingDelegation.inDatabase("foobar");
+
+ verify(exactly = 1) { ongoingDelegation.`in`("foobar") }
+ }
+}
\ No newline at end of file
diff --git a/spring-data-neo4j/src/test/kotlin/org/neo4j/springframework/data/core/ReactiveNeo4jClientExtensionsTest.kt b/spring-data-neo4j/src/test/kotlin/org/neo4j/springframework/data/core/ReactiveNeo4jClientExtensionsTest.kt
new file mode 100644
index 000000000..85f72a511
--- /dev/null
+++ b/spring-data-neo4j/src/test/kotlin/org/neo4j/springframework/data/core/ReactiveNeo4jClientExtensionsTest.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2019 "Neo4j,"
+ * Neo4j Sweden AB [https://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * 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.neo4j.springframework.data.core
+
+import io.mockk.mockk
+import io.mockk.verify
+import org.junit.jupiter.api.Test
+
+/**
+ * @author Michael J. Simons
+ */
+class ReactiveNeo4jClientExtensionsTest {
+
+ @Test
+ fun `RunnableSpec#inDatabase(targetDatabase) extension should call its Java counterpart`() {
+
+ val runnableSpec = mockk(relaxed = true)
+
+ runnableSpec.inDatabase("foobar");
+
+ verify(exactly = 1) { runnableSpec.`in`("foobar") }
+ }
+
+ @Test
+ fun `OngoingDelegation#inDatabase(targetDatabase) extension should call its Java counterpart`() {
+
+ val ongoingDelegation = mockk>(relaxed = true)
+
+ ongoingDelegation.inDatabase("foobar");
+
+ verify(exactly = 1) { ongoingDelegation.`in`("foobar") }
+ }
+}
\ No newline at end of file
diff --git a/spring-data-neo4j/src/test/kotlin/org/neo4j/springframework/data/core/cypher/CypherExtensionsTest.kt b/spring-data-neo4j/src/test/kotlin/org/neo4j/springframework/data/core/cypher/CypherExtensionsTest.kt
new file mode 100644
index 000000000..127e01efc
--- /dev/null
+++ b/spring-data-neo4j/src/test/kotlin/org/neo4j/springframework/data/core/cypher/CypherExtensionsTest.kt
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019 "Neo4j,"
+ * Neo4j Sweden AB [https://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * 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.neo4j.springframework.data.core.cypher
+
+import io.mockk.mockk
+import io.mockk.verify
+import org.junit.jupiter.api.Nested
+import org.junit.jupiter.api.Test
+import org.neo4j.springframework.data.core.cypher.Cypher.listOf
+import org.neo4j.springframework.data.core.cypher.Cypher.literalFalse
+
+/**
+ * @author Michael J. Simons
+ */
+class CypherExtensionsTest {
+
+ @Nested
+ inner class ExpressionExtensions {
+ val expression = mockk(relaxed = true)
+
+ @Test
+ fun `inValues(expression) extension should call its Java counterpart`() {
+
+ expression.inValues(listOf(literalFalse()));
+
+ verify(exactly = 1) { expression.`in`(any()) }
+ }
+
+ @Test
+ fun `asAlias(alias) extension should call its Java counterpart`() {
+
+ expression.asAlias("foo")
+
+ verify(exactly = 1) { expression.`as`("foo") }
+ }
+ }
+
+ @Nested
+ inner class StatementBuilderExtensions {
+
+ @Test
+ fun `asAlias(alias) extension should call its Java counterpart`() {
+ val ongoingUnwind = mockk(relaxed = true)
+
+ ongoingUnwind.asAlias("foo")
+
+ verify(exactly = 1) { ongoingUnwind.`as`("foo") }
+ }
+ }
+}