Browse Source
Reformat code. Add Kotlin test to verify Criteria usage. See #2226 Original pull request: #2227main
8 changed files with 95 additions and 15 deletions
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright 2026-present 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.relational.core.query |
||||
|
||||
import org.assertj.core.api.Assertions.assertThat |
||||
import org.junit.jupiter.api.Test |
||||
import org.springframework.data.core.div |
||||
|
||||
/** |
||||
* Kotlin unit tests for [Criteria]. |
||||
* |
||||
* @author Mark Paluch |
||||
*/ |
||||
class CriteriaKtUnitTests { |
||||
|
||||
@Test |
||||
fun shouldAcceptKProperty() { |
||||
assertThat( |
||||
Criteria.where(Person::lastName).isEqual("foo") |
||||
).isEqualTo(Criteria.where("lastName").isEqual("foo")) |
||||
} |
||||
|
||||
@Test |
||||
fun shouldAcceptKPropertyPath() { |
||||
assertThat( |
||||
Criteria.where(Person::parent / Person::lastName).isEqual("foo") |
||||
).isEqualTo(Criteria.where("parent.lastName").isEqual("foo")) |
||||
} |
||||
|
||||
data class Person(val firstName: String, val lastName: String, val parent: Person) |
||||
|
||||
} |
||||
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
include::{commons}@data-commons::page$property-paths.adoc[] |
||||
Loading…
Reference in new issue