Package de.ppi.deepsampler.junit.json
Class JsonSourceManagerFactory
java.lang.Object
de.ppi.deepsampler.junit.json.JsonSourceManagerFactory
- All Implemented Interfaces:
de.ppi.deepsampler.junit.SourceManagerFactory<de.ppi.deepsampler.persistence.json.JsonSourceManager>
public class JsonSourceManagerFactory
extends java.lang.Object
implements de.ppi.deepsampler.junit.SourceManagerFactory<de.ppi.deepsampler.persistence.json.JsonSourceManager>
JsonSourceManagerFactory creates and configures a JsonSourceManager. It is used by the annotations LoadSamples
and SaveSamples, to configure the usage of JSON for recording and loading of samples.
Tests, that want to use json-files to load and record samples, may use the following annotations to configure
the JsonSourceManager:
LoadSamplesloads a json-file before a test method is startedSaveSamplesrecords all calls to stubbed methods during a test and saves the recorded samples as a json-file after the test has finishedUseJsonDeserializerregisters a customJsonDeserializerthat is used by Jackson (the underlying json-api) to load objects, that cannot be loaded by defaultUseJsonSerializerregisters a customJsonSerializerthat is used by Jackson (the underlying json-api) to save objects, that cannot be saved by defaultSampleRootPathdefines the root path under which Json-files are saved.UseCharsetdefines theCharsetthat is used to write and read the Json-files
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_ROOT_PATH -
Constructor Summary
Constructors Constructor Description JsonSourceManagerFactory() -
Method Summary
Modifier and Type Method Description de.ppi.deepsampler.persistence.json.JsonSourceManagercreateSourceManagerToLoadSamples(java.lang.reflect.Method testMethod)de.ppi.deepsampler.persistence.json.JsonSourceManagercreateSourceManagerToSaveSamples(java.lang.reflect.Method testMethod)java.lang.StringgetDefaultJsonFileName(java.lang.reflect.Method testMethod)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
DEFAULT_ROOT_PATH
public static final java.lang.String DEFAULT_ROOT_PATH- See Also:
- Constant Field Values
-
-
Constructor Details
-
JsonSourceManagerFactory
public JsonSourceManagerFactory()
-
-
Method Details
-
createSourceManagerToLoadSamples
public de.ppi.deepsampler.persistence.json.JsonSourceManager createSourceManagerToLoadSamples(java.lang.reflect.Method testMethod)- Specified by:
createSourceManagerToLoadSamplesin interfacede.ppi.deepsampler.junit.SourceManagerFactory<de.ppi.deepsampler.persistence.json.JsonSourceManager>
-
createSourceManagerToSaveSamples
public de.ppi.deepsampler.persistence.json.JsonSourceManager createSourceManagerToSaveSamples(java.lang.reflect.Method testMethod)- Specified by:
createSourceManagerToSaveSamplesin interfacede.ppi.deepsampler.junit.SourceManagerFactory<de.ppi.deepsampler.persistence.json.JsonSourceManager>
-
getDefaultJsonFileName
public java.lang.String getDefaultJsonFileName(java.lang.reflect.Method testMethod)
-