Class IntegrationTestBase

  • Direct Known Subclasses:
    HttpResourceChainAwareResourceLoaderIT, HttpResourceProtocolResolverIT, HttpResourcesIT, ThymeleafWithHttpResourceProtocolResolverIT, VersionedResourcesIT

    public abstract class IntegrationTestBase
    extends Object
    This class starts a {@link https://www.testcontainers.org/modules/nginx/ NginX-Webserver} via a {@link https://www.testcontainers.org/ Testcontainer} and a standalone {@link http://www.mock-server.com/#what-is-mockserver MockServer}, that can be used to intercept requests for assertions / verifications.

    We use the {@link https://www.testcontainers.org/test_framework_integration/manual_lifecycle_control/#singleton-containers Singleton Pattern} to start the NginX-Testcontainer and start the MockServer programmatically via the {@link http://www.mock-server.com/mock_server/running_mock_server.html#client_api Client-API}.

    Author:
    Kai Moritz
    • Field Detail

      • NGINX

        public static final org.testcontainers.containers.NginxContainer NGINX
      • server

        @Autowired
        public org.mockserver.integration.ClientAndServer server
    • Constructor Detail

      • IntegrationTestBase

        public IntegrationTestBase()
    • Method Detail

      • NGINIX_IP

        public static String NGINIX_IP()
      • NGINX_PORT

        public static int NGINX_PORT()
      • NGINX_URI

        public static String NGINX_URI()
      • FETCH

        public static org.mockserver.model.HttpRequest FETCH​(String path)
      • RESPONSE

        public static org.mockserver.model.HttpResponse RESPONSE()
      • NGINX

        public static org.mockserver.model.HttpOverrideForwardedRequest NGINX()
      • NGINX

        public static org.mockserver.model.HttpOverrideForwardedRequest NGINX​(String path)
      • NOT_FOUND

        public static org.mockserver.model.HttpResponse NOT_FOUND()
      • INTERNAL_SERVER_ERROR

        public static org.mockserver.model.HttpResponse INTERNAL_SERVER_ERROR()
      • prepareMockServer

        @BeforeEach
        public void prepareMockServer()
        Prepares the mock-server to forward any request to the NginX-server, for which no more specific expectation was specified.
      • clearMockServer

        @AfterEach
        public void clearMockServer()
      • getMockServerPort

        public int getMockServerPort()
      • getMockServerUri

        public String getMockServerUri()