Class Cassette

java.lang.Object
com.easypost.easyvcr.Cassette

public final class Cassette extends Object
Cassette used to store and retrieve requests and responses for EasyVCR.
  • Field Details

    • name

      public final String name
      The name of the cassette.
  • Constructor Details

    • Cassette

      public Cassette(String folderPath, String cassetteName)
      Constructor for Cassette.
      Parameters:
      folderPath - The path to the folder where the cassette file will be stored.
      cassetteName - The name of the cassette.
  • Method Details

    • numInteractions

      public int numInteractions()
      Gets the number of interactions in the cassette.
      Returns:
      The number of interactions in the cassette.
    • erase

      public void erase()
      Erase this cassette by deleting the file.
    • lock

      public void lock()
      Lock this cassette (prevent reading or writing).
    • unlock

      public void unlock()
      Unlock this cassette (allow the cassette to be used).
    • read

      public List<HttpInteraction> read() throws VCRException
      Read all the interactions recorded on this cassette.
      Returns:
      A list of HttpInteractions
      Throws:
      VCRException - If the cassette could not be read
    • updateInteraction

      public void updateInteraction(HttpInteraction httpInteraction, MatchRules matchRules, boolean bypassSearch) throws VCRException
      Overwrite an existing interaction on this cassette, or add a new one if it doesn't exist.
      Parameters:
      httpInteraction - The interaction to write to the cassette
      matchRules - The rules to match the interaction against
      bypassSearch - If true, the cassette will not be searched for an existing interaction
      Throws:
      VCRException - If the cassette could not be written to