Package com.azure.core.test
Class TestContextManager
java.lang.Object
com.azure.core.test.TestContextManager
This class handles managing context about a test, such as custom testing annotations and verifying whether the test
is capable of running.
-
Constructor Summary
ConstructorsConstructorDescriptionTestContextManager(Method testMethod, TestMode testMode) Constructs aTestContextManagerbased on the test method.TestContextManager(Method testMethod, TestMode testMode, boolean enableTestProxy, boolean recordWithoutRequestBodyClassAnnotation, Path testClassPath) Constructs aTestContextManagerbased on the test method. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the current test was ran.booleanReturns whether the test should have its network calls recorded during arecordtest run.Returns the mode being used to run tests.Returns the name of the test being ran.Returns the name of the playback record for the test being ran.booleanReturns if the test proxy is enabledbooleanReturns whether the test is recording request body when runrecordmode.
-
Constructor Details
-
TestContextManager
Constructs aTestContextManagerbased on the test method.- Parameters:
testMethod- Test method being ran.testMode- TheTestModethe test is running in.
-
TestContextManager
public TestContextManager(Method testMethod, TestMode testMode, boolean enableTestProxy, boolean recordWithoutRequestBodyClassAnnotation, Path testClassPath) Constructs aTestContextManagerbased on the test method.- Parameters:
testMethod- Test method being ran.testMode- TheTestModethe test is running in.enableTestProxy- True if the external test proxy is in use.recordWithoutRequestBodyClassAnnotation- flag indicating ifRecordWithoutRequestBodyannotation present on test class.testClassPath- the test class path
-
-
Method Details
-
getTestName
Returns the name of the test being ran.- Returns:
- The test name.
-
getTestPlaybackRecordingName
Returns the name of the playback record for the test being ran.- Returns:
- The playback record name.
-
getTestMode
Returns the mode being used to run tests.- Returns:
- The
TestModebeing used to run tests.
-
isTestProxyEnabled
public boolean isTestProxyEnabled()Returns if the test proxy is enabled- Returns:
- True if the text proxy is enabled
-
doNotRecordTest
public boolean doNotRecordTest()Returns whether the test should have its network calls recorded during arecordtest run.- Returns:
- Flag indicating whether to record test network calls.
-
skipRecordingRequestBody
public boolean skipRecordingRequestBody()Returns whether the test is recording request body when runrecordmode.- Returns:
- Flag indicating whether test should record request bodies.
-
didTestRun
public boolean didTestRun()Returns whether the current test was ran.- Returns:
- Flag indicating whether the current test was ran.
-