All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.com.bkahlert.kommons.test.junit.SimpleIdResolver.kt Maven / Gradle / Ivy

There is a newer version: 2.8.0
Show newest version
package com.bkahlert.kommons.test.junit

import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.api.extension.ParameterContext
import org.junit.jupiter.api.extension.ParameterResolver
import org.junit.jupiter.api.extension.support.TypeBasedParameterResolver
import org.junit.platform.engine.UniqueId

/** [ParameterResolver] that resolves the [SimpleId] of the current test or container.*/
public class SimpleIdResolver : TypeBasedParameterResolver() {
    override fun resolveParameter(parameterContext: ParameterContext, extensionContext: ExtensionContext): SimpleId =
        extensionContext.simpleId

    public companion object {

        /** The [SimpleId] of the current test or container. */
        public val ExtensionContext.simpleId: SimpleId get(): SimpleId = SimpleId.from(UniqueId.parse(uniqueId))
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy