Skip to content

Add Kotlin DSL extension functions for TestEntityManager #37963

Open
@csikb

Description

@csikb

Consider adding Kotlin DSL extension functions for TestEntityManager.

package org.springframework.boot.test.autoconfigure.orm.jpa

inline fun <reified T> TestEntityManager.find(primaryKey: Any?): T {
    return this.find(T::class.java, primaryKey)
}

inline fun <reified T> TestEntityManager.persistAndGetId(entity: Any): T {
    return this.persistAndGetId(entity, T::class.java)
}

inline fun <reified T> TestEntityManager.getId(entity: Any): T {
    return this.getId(entity, T::class.java)
}

There are possibly more classes that could be considered to add Kotlin DSL functions for.
This change would enhance the Kotlin experience when using this library :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions