ExtractorAsserts
@UnstableApi
public final class ExtractorAsserts
Assertion methods for Extractor.
Summary
Nested types |
|---|
public class ExtractorAsserts.AssertionConfigA config for the assertions made (e.g. dump file location). |
public class ExtractorAsserts.AssertionConfig.BuilderBuilder for |
public final class ExtractorAsserts.ConfigProvider extends TestParameterValuesProviderA |
public interface ExtractorAsserts.ExtractorFactoryA factory for |
public class ExtractorAsserts.SimulationConfigA config of different environments to simulate and extractor behaviours to test. |
Constants |
|
|---|---|
static final int |
Public methods |
|
|---|---|
static void |
assertBehavior(Asserts that an extractor consumes valid input data successfully under the conditions specified by |
static void |
assertBehavior(Asserts that an extractor consumes valid input data successfully under the conditions specified by |
static void |
assertBehavior(Asserts that an extractor consumes valid input data successfully under the conditions specified by |
static void |
assertBehavior(Asserts that an extractor consumes valid input data successfully under the conditions specified by |
static void |
assertSniff(Asserts that |
static void |
assertSniff(Asserts that |
static ImmutableList<ExtractorAsserts.SimulationConfig> |
configs()Returns a list of arrays containing |
static List<Object[]> |
Returns a list of arrays containing |
Constants
Public methods
assertBehavior
public static void assertBehavior(
ExtractorAsserts.ExtractorFactory factory,
String file,
ExtractorAsserts.SimulationConfig simulationConfig
)
Asserts that an extractor consumes valid input data successfully under the conditions specified by simulationConfig.
The output of the extractor is compared against prerecorded dump files whose names are derived from the file parameter as specified in the docs for dumpFilesPrefix.
| Parameters | |
|---|---|
ExtractorAsserts.ExtractorFactory factory |
An |
String file |
The path to the input sample. |
ExtractorAsserts.SimulationConfig simulationConfig |
Details on the environment to simulate and behaviours to assert. |
| Throws | |
|---|---|
java.io.IOException |
If reading from the input fails. |
assertBehavior
public static void assertBehavior(
ExtractorAsserts.ExtractorFactory factory,
String file,
ExtractorAsserts.AssertionConfig assertionConfig,
ExtractorAsserts.SimulationConfig simulationConfig
)
Asserts that an extractor consumes valid input data successfully under the conditions specified by simulationConfig.
The output of the extractor is compared against prerecorded dump files.
| Parameters | |
|---|---|
ExtractorAsserts.ExtractorFactory factory |
An |
String file |
The input file to pass to the extractor. |
ExtractorAsserts.AssertionConfig assertionConfig |
Details of how to read and process the source and dump files. |
ExtractorAsserts.SimulationConfig simulationConfig |
Details on the environment to simulate and behaviours to assert. |
| Throws | |
|---|---|
java.io.IOException |
If reading from the input fails. |
assertBehavior
public static void assertBehavior(
ExtractorAsserts.ExtractorFactory factory,
String file,
int peekLimit,
ExtractorAsserts.SimulationConfig simulationConfig
)
Asserts that an extractor consumes valid input data successfully under the conditions specified by simulationConfig.
The output of the extractor is compared against prerecorded dump files whose names are derived from the file parameter as specified in the docs for dumpFilesPrefix.
| Parameters | |
|---|---|
ExtractorAsserts.ExtractorFactory factory |
An |
String file |
The path to the input sample. |
int peekLimit |
The limit that |
ExtractorAsserts.SimulationConfig simulationConfig |
Details on the environment to simulate and behaviours to assert. |
| Throws | |
|---|---|
java.io.IOException |
If reading from the input fails. |
assertBehavior
public static void assertBehavior(
ExtractorAsserts.ExtractorFactory factory,
String file,
int peekLimit,
ExtractorAsserts.AssertionConfig assertionConfig,
ExtractorAsserts.SimulationConfig simulationConfig
)
Asserts that an extractor consumes valid input data successfully under the conditions specified by simulationConfig.
The output of the extractor is compared against prerecorded dump files.
| Parameters | |
|---|---|
ExtractorAsserts.ExtractorFactory factory |
An |
String file |
The input file to pass to the extractor. |
int peekLimit |
The limit that |
ExtractorAsserts.AssertionConfig assertionConfig |
Details of how to read and process the source and dump files. |
ExtractorAsserts.SimulationConfig simulationConfig |
Details on the environment to simulate and behaviours to assert. |
| Throws | |
|---|---|
java.io.IOException |
If reading from the input fails. |
assertSniff
public static void assertSniff(
Extractor extractor,
FakeExtractorInput input,
boolean expectedResult
)
Asserts that sniff returns the expectedResult for a given input, retrying repeatedly when SimulatedIOException is thrown.
| Parameters | |
|---|---|
Extractor extractor |
The extractor to test. |
FakeExtractorInput input |
The extractor input. |
boolean expectedResult |
The expected return value. |
| Throws | |
|---|---|
java.io.IOException |
If reading from the input fails. |
assertSniff
public static void assertSniff(
Extractor extractor,
String file,
int peekLimit,
boolean expectedResult
)
Asserts that sniff returns the expectedResult for a given file, retrying repeatedly when SimulatedIOException is thrown.
| Parameters | |
|---|---|
Extractor extractor |
The extractor to test. |
String file |
The path to the input sample. |
int peekLimit |
The limit that |
boolean expectedResult |
The expected return value. |
| Throws | |
|---|---|
java.io.IOException |
If reading from the input fails. |
configs
public static ImmutableList<ExtractorAsserts.SimulationConfig> configs()
Returns a list of arrays containing SimulationConfig objects to exercise different extractor paths.
This is intended to be used from tests using ParameterizedRobolectricTestRunner or org.junit.runners.Parameterized.
configsNoSniffing
public static List<Object[]> configsNoSniffing()
Returns a list of arrays containing SimulationConfig objects to exercise different extractor paths in which the input is not sniffed.
This is intended to be used from tests using ParameterizedRobolectricTestRunner or org.junit.runners.Parameterized.