Package com.easypost.easyvcr
Class Cassette
java.lang.Object
com.easypost.easyvcr.Cassette
Cassette used to store and retrieve requests and responses for EasyVCR.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiderase()Erase this cassette by deleting the file.voidlock()Lock this cassette (prevent reading or writing).intGets the number of interactions in the cassette.read()Read all the interactions recorded on this cassette.voidunlock()Unlock this cassette (allow the cassette to be used).voidupdateInteraction(HttpInteraction httpInteraction, MatchRules matchRules, boolean bypassSearch)Overwrite an existing interaction on this cassette, or add a new one if it doesn't exist.
-
Field Details
-
name
The name of the cassette.
-
-
Constructor Details
-
Cassette
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
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 VCRExceptionOverwrite an existing interaction on this cassette, or add a new one if it doesn't exist.- Parameters:
httpInteraction- The interaction to write to the cassettematchRules- The rules to match the interaction againstbypassSearch- If true, the cassette will not be searched for an existing interaction- Throws:
VCRException- If the cassette could not be written to
-