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

org.http4k.hamkrest.LensMatcher.kt Maven / Gradle / Ivy

There is a newer version: 5.31.0.0
Show newest version
package org.http4k.hamkrest

import com.natpryce.hamkrest.MatchResult
import com.natpryce.hamkrest.Matcher
import org.http4k.lens.LensFailure

internal class LensMatcher(private val matcher: Matcher) : Matcher {
    override val description = matcher.description

    override fun invoke(actual: R): MatchResult = try {
        matcher(actual)
    } catch (e: LensFailure) {
        MatchResult.Mismatch("lens could not extract valid value from: $actual")
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy