Class PhotonAppTestRule

java.lang.Object
org.junit.rules.ExternalResource
com.helger.scope.mock.ScopeTestRule
com.helger.photon.app.mock.PhotonAppTestRule
All Implemented Interfaces:
org.junit.rules.TestRule

public class PhotonAppTestRule extends com.helger.scope.mock.ScopeTestRule
Non-web scope aware test rule, with a defined storage root directory
Author:
Philip Helger
  • Constructor Details

    • PhotonAppTestRule

      public PhotonAppTestRule()
      Ctor using the default storage path from ScopeTestRule
    • PhotonAppTestRule

      public PhotonAppTestRule(@Nonnull File aPath)
      Ctor with an arbitrary path
      Parameters:
      aPath - The data AND servlet context path to be used. May not be null.
      Since:
      8.0.1
    • PhotonAppTestRule

      public PhotonAppTestRule(@Nonnull File aDataPath, @Nonnull @Nonempty String sServletContextPath)
      Ctor with an arbitrary path
      Parameters:
      aDataPath - The data path to be used. May not be null.
      sServletContextPath - The servlet context path to be used. May not be null.
  • Method Details

    • getDataPath

      @Nonnull public final File getDataPath()
      Returns:
      The used data path. Never null.
    • getServletContextPath

      @Nonnull @Nonempty public final String getServletContextPath()
      Returns:
      The used servlet context path. Never null.
    • setDeleteAllData

      @Nonnull public final PhotonAppTestRule setDeleteAllData(boolean bDeleteAllData)
      Delete the directories with data and servlet context path before each iteration?
      Parameters:
      bDeleteAllData - true to delete them in before(), false if not.
      Returns:
      this for chaining
    • before

      public void before()
      Overrides:
      before in class com.helger.scope.mock.ScopeTestRule
    • after

      public void after()
      Overrides:
      after in class com.helger.scope.mock.ScopeTestRule