com.github.mvysny.kaributesting.v10.groovy.MockVaadinExtensionMethods.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of karibu-testing-v10-groovy Show documentation
Show all versions of karibu-testing-v10-groovy Show documentation
Karibu Testing, support for browserless Vaadin testing in Kotlin
package com.github.mvysny.kaributesting.v10.groovy
import com.github.mvysny.fakeservlet.FakeHttpSession
import com.github.mvysny.fakeservlet.FakeRequest
import com.github.mvysny.fakeservlet.FakeResponse
import com.github.mvysny.kaributesting.v10.UtilsKt
import com.vaadin.flow.server.VaadinRequest
import com.vaadin.flow.server.VaadinResponse
import com.vaadin.flow.server.VaadinSession
import groovy.transform.CompileStatic
import org.jetbrains.annotations.NotNull
@CompileStatic
class MockVaadinExtensionMethods {
/**
* Retrieves the mock request which backs up [VaadinRequest].
*
* currentRequest.mock.addCookie(Cookie("foo", "bar"))
*
*/
@NotNull
static FakeRequest getMock(@NotNull VaadinRequest self) {
UtilsKt.getMock(self)
}
/**
* Retrieves the mock request which backs up [VaadinResponse].
*
* currentResponse.mock.getCookie("foo").value
*
*/
@NotNull
static FakeResponse getMock(@NotNull VaadinResponse self) {
UtilsKt.getMock(self)
}
/**
* Retrieves the mock session which backs up [VaadinSession].
*
* VaadinSession.getCurrent().mock
*
*/
@NotNull
static FakeHttpSession getMock(@NotNull VaadinSession self) {
UtilsKt.getMock(self)
}
}