Enum SpringBootTest.WebEnvironment

    • Enum Constant Detail

      • MOCK

        public static final SpringBootTest.WebEnvironment MOCK
        Creates a WebApplicationContext with a mock servlet environment or a regular ApplicationContext if servlet APIs are not on the classpath.
      • RANDOM_PORT

        public static final SpringBootTest.WebEnvironment RANDOM_PORT
        Creates an EmbeddedWebApplicationContext and sets a server.port=0Environment property (which usually triggers listening on a random port). Often used in conjunction with a LocalServerPort injected field on the test.
    • Method Detail

      • values

        public static SpringBootTest.WebEnvironment[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (SpringBootTest.WebEnvironment c : SpringBootTest.WebEnvironment.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static SpringBootTest.WebEnvironment valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • isEmbedded

        public boolean isEmbedded()
        Return if the environment uses an EmbeddedWebApplicationContext.
        Returns:
        if an EmbeddedWebApplicationContext is used.