Class PrepAndExpectedTestData
PrepAndExpectedTestCase run, bundled as a single immutable
value.
PrepAndExpectedTestCase.configureTest(PrepAndExpectedTestData),
PrepAndExpectedTestCase.preTest(PrepAndExpectedTestData), and
PrepAndExpectedTestCase.runTest(PrepAndExpectedTestData, PrepAndExpectedTestCaseSteps)
each accept one of these in place of the three separate array arguments their
older overloads take. The three values describe one test scenario and are
meaningless apart, so passing them as one argument keeps a data-driven test's
@MethodSource rows, parameter lists, and any row-factory methods from
carrying the same triple through every layer, and collapses the three
per-scenario "empty" constants a suite would otherwise declare into the shared
NONE.
An instance carries no mutable state of its own: the constructor copies each
array in, every getter copies its array out, and a null array is
normalized to an empty one. The VerifyTableDefinition elements are
referenced as given rather than deep-copied, so a caller must not mutate a
VerifyTableDefinition through its setters once it has been passed to
this constructor; doing so retroactively changes the scenario an
already-built instance describes. This matches how a suite is expected to
supply them - as shared static final constants.
- Since:
- 3.6.0
- Author:
- Jeff Jensen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PrepAndExpectedTestDataVerifies no tables, loads no prep data, and expects no data. -
Constructor Summary
ConstructorsConstructorDescriptionPrepAndExpectedTestData(VerifyTableDefinition[] verifyTableDefinitions, String[] prepDataFiles, String[] expectedDataFiles) Creates an instance carrying the given verification definitions and prep and expected data file paths. -
Method Summary
Modifier and TypeMethodDescriptionbooleanString[]Returns the expected data file paths.String[]Returns the prep data file paths.Returns the table definitions to verify after the test runs.inthashCode()static PrepAndExpectedTestDataCreates an instance that loads the given prep data files and does nothing else - verifies no tables and expects no data.toString()
-
Field Details
-
NONE
Verifies no tables, loads no prep data, and expects no data. The shared constant for a scenario that needs none of the three, replacing a separate empty constant per type.
-
-
Constructor Details
-
PrepAndExpectedTestData
public PrepAndExpectedTestData(VerifyTableDefinition[] verifyTableDefinitions, String[] prepDataFiles, String[] expectedDataFiles) Creates an instance carrying the given verification definitions and prep and expected data file paths.- Parameters:
verifyTableDefinitions- The table definitions to verify after the test runs;nullor empty verifies no tables.prepDataFiles- The prep data files (as classpath resources) to load and insert as seed data;nullor empty loads none.expectedDataFiles- The expected data files (as classpath resources) to verify actual data against after the test runs;nullor empty expects none.
-
-
Method Details
-
prepOnly
Creates an instance that loads the given prep data files and does nothing else - verifies no tables and expects no data.- Parameters:
prepDataFiles- The prep data files (as classpath resources) to load and insert as seed data.- Returns:
- The instance.
-
getVerifyTableDefinitions
Returns the table definitions to verify after the test runs.- Returns:
- A copy of the verify table definitions; empty if none.
-
getPrepDataFiles
Returns the prep data file paths.- Returns:
- A copy of the prep data file paths; empty if none.
-
getExpectedDataFiles
Returns the expected data file paths.- Returns:
- A copy of the expected data file paths; empty if none.
-
equals
Two instances are equal when their prep and expected file paths match by content and their verify table definitions match by array position.
VerifyTableDefinitiondoes not define value equality, so that part of the comparison is by instance identity - which is what the intended usage produces: sharingstatic finalVerifyTableDefinitionconstants across scenarios. -
hashCode
public int hashCode() -
toString
-