Modifier and Type | Class | Description |
---|---|---|
static class |
ExtractorAsserts.AssertionConfig |
A config for the assertions made (e.g.
|
static interface |
ExtractorAsserts.ExtractorFactory |
A factory for
Extractor instances. |
static class |
ExtractorAsserts.SimulationConfig |
A config of different environments to simulate and extractor behaviours to test.
|
Modifier and Type | Method | Description |
---|---|---|
static void |
assertAllBehaviors(ExtractorAsserts.ExtractorFactory factory,
String file) |
Asserts that an extractor behaves correctly given valid input data.
|
static void |
assertAllBehaviors(ExtractorAsserts.ExtractorFactory factory,
String file,
String dumpFilesPrefix) |
Asserts that an extractor behaves correctly given valid input data:
Calls
Extractor.seek(long, long) and Extractor.release() without calling
Extractor.init(ExtractorOutput) to check these calls do not fail. |
static void |
assertBehavior(ExtractorAsserts.ExtractorFactory factory,
String file,
ExtractorAsserts.AssertionConfig assertionConfig,
ExtractorAsserts.SimulationConfig simulationConfig) |
Asserts that an extractor consumes valid input data successfully successfully under the
conditions specified by
simulationConfig . |
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 . |
static void |
assertSniff(Extractor extractor,
FakeExtractorInput input,
boolean expectedResult) |
Asserts that
Extractor.sniff(ExtractorInput) returns the expectedResult for a
given input , retrying repeatedly when FakeExtractorInput.SimulatedIOException is thrown. |
static List<Object[]> |
configs() |
Returns a list of arrays containing
ExtractorAsserts.SimulationConfig objects to exercise different
extractor paths. |
public static List<Object[]> configs()
ExtractorAsserts.SimulationConfig
objects to exercise different
extractor paths.
This is intended to be used from tests using ParameterizedRobolectricTestRunner
or
org.junit.runners.Parameterized
.
public static void assertSniff(Extractor extractor, FakeExtractorInput input, boolean expectedResult) throws IOException
Extractor.sniff(ExtractorInput)
returns the expectedResult
for a
given input
, retrying repeatedly when FakeExtractorInput.SimulatedIOException
is thrown.extractor
- The extractor to test.input
- The extractor input.expectedResult
- The expected return value.IOException
- If reading from the input fails.public static void assertAllBehaviors(ExtractorAsserts.ExtractorFactory factory, String file) throws IOException
Extractor.seek(long, long)
and Extractor.release()
without calling
Extractor.init(ExtractorOutput)
to check these calls do not fail.
assertOutput(Extractor, String, byte[], Context, boolean, boolean, boolean,
boolean, boolean)
with all possible combinations of "simulate" parameters.
factory
- An ExtractorAsserts.ExtractorFactory
which creates instances of the Extractor
class which is to be tested.file
- The path to the input sample.IOException
- If reading from the input fails.public static void assertAllBehaviors(ExtractorAsserts.ExtractorFactory factory, String file, String dumpFilesPrefix) throws IOException
Extractor.seek(long, long)
and Extractor.release()
without calling
Extractor.init(ExtractorOutput)
to check these calls do not fail.
assertOutput(Extractor, String, byte[], Context, boolean, boolean, boolean,
boolean, boolean)
with all possible combinations of "simulate" parameters.
factory
- An ExtractorAsserts.ExtractorFactory
which creates instances of the Extractor
class which is to be tested.file
- The path to the input sample.dumpFilesPrefix
- The dump files prefix appended to the dump files path.IOException
- If reading from the input fails.public static void assertBehavior(ExtractorAsserts.ExtractorFactory factory, String file, ExtractorAsserts.SimulationConfig simulationConfig) throws IOException
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 ExtractorAsserts.AssertionConfig.dumpFilesPrefix
.
factory
- An ExtractorAsserts.ExtractorFactory
which creates instances of the Extractor
class which is to be tested.file
- The path to the input sample.simulationConfig
- Details on the environment to simulate and behaviours to assert.IOException
- If reading from the input fails.public static void assertBehavior(ExtractorAsserts.ExtractorFactory factory, String file, ExtractorAsserts.AssertionConfig assertionConfig, ExtractorAsserts.SimulationConfig simulationConfig) throws IOException
simulationConfig
.
The output of the extractor is compared against prerecorded dump files.
assertionConfig
- Details of how to read and process the source and dump files.simulationConfig
- Details on the environment to simulate and behaviours to assert.IOException
- If reading from the input fails.