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

pl.allegro.tech.servicemesh.envoycontrol.assertions.HttpsEchoResponseAssertions.kt Maven / Gradle / Ivy

There is a newer version: 0.22.1
Show newest version
package pl.allegro.tech.servicemesh.envoycontrol.assertions

import org.assertj.core.api.Assertions
import org.assertj.core.api.ObjectAssert
import pl.allegro.tech.servicemesh.envoycontrol.config.service.HttpsEchoContainer
import pl.allegro.tech.servicemesh.envoycontrol.config.service.HttpsEchoResponse
import java.util.function.Consumer

fun ObjectAssert.isOk(): ObjectAssert {
    matches { it.response.isSuccessful }
    return this
}

fun ObjectAssert.hasSNI(serverName: String): ObjectAssert = satisfies(Consumer {
    val actualServerName = HttpsEchoResponse.objectMapper.readTree(it.body).at("/connection/servername").textValue()
    Assertions.assertThat(actualServerName).isEqualTo(serverName)
})

fun ObjectAssert.isFrom(container: HttpsEchoContainer) = satisfies(Consumer {
    Assertions.assertThat(container.containerName()).isEqualTo(it.hostname)
})




© 2015 - 2024 Weber Informatics LLC | Privacy Policy