Eric
12/18/2024, 2:59 PMtoString
?
@MethodSource("entityClasses")
@ParameterizedTest(name = "test {1} child collections that are not an immutable Set have @OneToMany(orphanRemoval = true)")
fun `test entities mutable child collections have @OneToMany(orphanRemoval = true)`(
entityClass: Class<*>,
className: String,
) {
expectThat(entityClass.kotlin.declaredMemberProperties)
.filter { it.returnType.isSubtypeOf(Collection::class.starProjectedType) }
.filterNot { it.returnType.toString().startsWith("kotlin.collections.Set") }
.map { requireNotNull(it.javaField).getAnnotation(OneToMany::class.java) }
.all { get { orphanRemoval }.isTrue() }
}
igor.wojda
12/19/2024, 9:13 AMEric
12/19/2024, 3:31 PM