public static enum SpringBootTest.WebEnvironment extends Enum<SpringBootTest.WebEnvironment>
Enum Constant and Description |
---|
DEFINED_PORT
|
MOCK
Creates a
WebApplicationContext with a mock servlet environment or a
regular ApplicationContext if servlet APIs are not on the classpath. |
NONE
|
RANDOM_PORT
Creates an
EmbeddedWebApplicationContext and sets a
server.port=0 Environment property (which usually triggers
listening on a random port). |
Modifier and Type | Method and Description |
---|---|
boolean |
isEmbedded()
Return if the environment uses an
EmbeddedWebApplicationContext . |
static SpringBootTest.WebEnvironment |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SpringBootTest.WebEnvironment[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SpringBootTest.WebEnvironment MOCK
WebApplicationContext
with a mock servlet environment or a
regular ApplicationContext
if servlet APIs are not on the classpath.public static final SpringBootTest.WebEnvironment RANDOM_PORT
EmbeddedWebApplicationContext
and sets a
server.port=0
Environment
property (which usually triggers
listening on a random port). Often used in conjunction with a
LocalServerPort
injected field on the test.public static final SpringBootTest.WebEnvironment DEFINED_PORT
public static final SpringBootTest.WebEnvironment NONE
public static SpringBootTest.WebEnvironment[] values()
for (SpringBootTest.WebEnvironment c : SpringBootTest.WebEnvironment.values()) System.out.println(c);
public static SpringBootTest.WebEnvironment valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic boolean isEmbedded()
EmbeddedWebApplicationContext
.EmbeddedWebApplicationContext
is used.Copyright © 2016 Pivotal Software, Inc.. All rights reserved.