Package ratpack.groovy.test.embed
Interface GroovyEmbeddedApp
-
- All Superinterfaces:
ApplicationUnderTest
,AutoCloseable
,CloseableApplicationUnderTest
,EmbeddedApp
public interface GroovyEmbeddedApp extends EmbeddedApp
A more Groovy version ofEmbeddedApp
.import ratpack.groovy.test.embed.GroovyEmbeddedApp GroovyEmbeddedApp.of { handlers { get { render "root" } } } test { assert getText() == "root" }
- See Also:
EphemeralBaseDir
,EmbeddedApp
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static GroovyEmbeddedApp
from(EmbeddedApp embeddedApp)
static GroovyEmbeddedApp
fromHandler(Closure<?> handler)
static GroovyEmbeddedApp
fromHandlers(Closure<?> handlers)
static GroovyEmbeddedApp
fromServer(ServerConfigBuilder serverConfig, Closure<?> definition)
static GroovyEmbeddedApp
fromServer(ServerConfig serverConfig, Closure<?> definition)
static GroovyEmbeddedApp
of(Closure<?> definition)
Groovy version ofEmbeddedApp.of(Action)
that acceptsClosure
to configure the application.static GroovyEmbeddedApp
ratpack(Closure<?> script)
Creates anEmbeddedApp
from the provided closure delegating toGroovy.Ratpack
.default void
test(Closure<?> test)
-
Methods inherited from interface ratpack.test.ApplicationUnderTest
getHttpClient
-
Methods inherited from interface ratpack.test.CloseableApplicationUnderTest
test
-
Methods inherited from interface ratpack.test.embed.EmbeddedApp
close, getAddress, getServer
-
-
-
-
Method Detail
-
from
static GroovyEmbeddedApp from(EmbeddedApp embeddedApp)
-
of
static GroovyEmbeddedApp of(@DelegatesTo(value=GroovyRatpackServerSpec.class,strategy=1) Closure<?> definition) throws Exception
Groovy version ofEmbeddedApp.of(Action)
that acceptsClosure
to configure the application.The closure delegates to
GroovyRatpackServerSpec
.- Parameters:
definition
- the application definition- Returns:
- a Ratpack application
- Throws:
Exception
-
ratpack
static GroovyEmbeddedApp ratpack(@DelegatesTo(value=Ratpack.class,strategy=1) Closure<?> script) throws Exception
Creates anEmbeddedApp
from the provided closure delegating toGroovy.Ratpack
.import static ratpack.groovy.test.embed.GroovyEmbeddedApp.ratpack ratpack { bindings { bindInstance String, "root" } handlers { get { render get(String) } } } test { assert getText() == "root" }
- Parameters:
script
- the application definition- Returns:
- a Ratpack application.
- Throws:
Exception
- Since:
- 1.4
-
fromServer
static GroovyEmbeddedApp fromServer(ServerConfigBuilder serverConfig, @DelegatesTo(value=GroovyRatpackServerSpec.class,strategy=1) Closure<?> definition)
-
fromServer
static GroovyEmbeddedApp fromServer(ServerConfig serverConfig, @DelegatesTo(value=GroovyRatpackServerSpec.class,strategy=1) Closure<?> definition)
-
fromHandler
static GroovyEmbeddedApp fromHandler(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
-
fromHandlers
static GroovyEmbeddedApp fromHandlers(@DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handlers)
-
test
default void test(@DelegatesTo(value=TestHttpClient.class,strategy=1) Closure<?> test) throws Exception
- Throws:
Exception
-
-