Class AppIntegrationSpec

All Implemented Interfaces:
JSpecSupport

public abstract class AppIntegrationSpec extends IntegrationSpec
Bootstraps entire application, including AppControllerConfig class, which sets up all filters exactly as at run time. If a DBConnectionFilter is used in the application, it is bypassed. Instead, the DB connection to a test DB is made from a super class. A connection is opened to a test DB, transaction is started before each test. After each test, a connection is closed and a transaction is rolled back.
Author:
Igor Polevoy
  • Constructor Details

    • AppIntegrationSpec

      public AppIntegrationSpec()
  • Method Details

    • beforeAppIntegrationSpec

      @BeforeEach public void beforeAppIntegrationSpec() throws javax.servlet.ServletException
      Throws:
      javax.servlet.ServletException
    • afterAppIntegrationSpec

      @AfterEach public void afterAppIntegrationSpec()
    • getContext

      public AppContext getContext()
      Returns instance of AppContext
      Returns:
      instance of AppContext
    • controller

      protected RequestBuilder controller(String controllerPath)
      Takes controller path. A controller path is a full path to controller starting from context and ending in a name of a controller on URI.
      Overrides:
      controller in class IntegrationSpec
      Parameters:
      controllerPath - path to controller. Example: /admin/permissions where "admin" is a sub-package of controller and "permissions" is a name of controller. Such path implies a name of a controller class: app.controllers.admin.PermissionsController. Controller paths always starts with a slash: "/".
      Returns:
      instance of a builder to help define request.
    • suppressDb

      protected void suppressDb()
      Call this method from a constructor of your spec in cases you do not need DB connections. Calling from a "before" method will not work.