Interface ServerJunitExtension
- All Superinterfaces:
org.junit.jupiter.api.extension.AfterAllCallback
,org.junit.jupiter.api.extension.AfterEachCallback
,org.junit.jupiter.api.extension.BeforeAllCallback
,org.junit.jupiter.api.extension.BeforeEachCallback
,org.junit.jupiter.api.extension.Extension
,HelidonJunitExtension
- All Known Implementing Classes:
Http1ServerJunitExtension
,Http2ServerExtension
,WsServerExtension
Java
ServiceLoader
provider interface for extending server tests with support for additional injection,
such as HTTP/1.1 client.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Handler of server test parameters of methods annotated withSetUpRoute
. -
Method Summary
Modifier and TypeMethodDescriptiondefault Object
resolveParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext, Class<?> parameterType, WebServer server) Resolve a parameter.default Optional
<ServerJunitExtension.ParamHandler<?>> setUpRouteParamHandler
(Class<?> type) Check if the type is supported and return a handler for it.default void
updateListenerBuilder
(String socketName, ListenerConfig.Builder listenerBuilder, Router.RouterBuilder<?> routerBuilder) Called for sockets defined bySetUpRoute
.default void
Update WebServer builder.Methods inherited from interface io.helidon.webserver.testing.junit5.spi.HelidonJunitExtension
afterAll, afterEach, beforeAll, beforeEach, supportsParameter
-
Method Details
-
updateServerBuilder
Update WebServer builder.- Parameters:
builder
- builder to update, will be used to build server instance
-
updateListenerBuilder
default void updateListenerBuilder(String socketName, ListenerConfig.Builder listenerBuilder, Router.RouterBuilder<?> routerBuilder) Called for sockets defined bySetUpRoute
.- Parameters:
socketName
- name of the socketlistenerBuilder
- listener configuration builderrouterBuilder
- router builder
-
resolveParameter
default Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext, Class<?> parameterType, WebServer server) Resolve a parameter. Provide an instance of the parameter. Only called ifHelidonJunitExtension.supportsParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext)
returnedtrue
.- Parameters:
parameterContext
- JUnit parameter contextextensionContext
- JUnit extension contextparameterType
- type of parameterserver
- webserver instance- Returns:
- instance of the expected type
-
setUpRouteParamHandler
Check if the type is supported and return a handler for it.- Parameters:
type
- type of the parameter toSetUpRoute
method- Returns:
- parameter handler if the type is supported, empty otherwise
-