public class VerifyEngine extends Object
VerifyRule
and expected data set.Constructor and Description |
---|
VerifyEngine(VerifyRule rule)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
VerifyEngine |
addExpected(DataModelSource expected)
Appends the expected data model objects.
|
List<Difference> |
inspectInput(DataModelSource input)
Verifies the input sequence and returns diagnostics.
|
List<Difference> |
inspectRest()
Verifies the rest of expected data objects.
|
public VerifyEngine(VerifyRule rule)
rule
- the verification strategyIllegalArgumentException
- if some parameters were null
public VerifyEngine addExpected(DataModelSource expected) throws IOException
If this already saw data model objects with same key in the expected input, the old one will be replaced with in input. Note that the expected input will be closed.
expected
- the expected inputIOException
- if failed to obtain model objects from the input,
or the input key is already registeredIllegalArgumentException
- if some parameters were null
public List<Difference> inspectInput(DataModelSource input) throws IOException
First, this engine search an expected model object corresponded to each input object using their
keys
.
If there are the such pairs, then this engine invokes
VerifyRule.verifyModel(eachExpected, eachInput)
for each pair, and then removes the expected data.
Otherwise, this engine invokes
VerifyRule.verifyModel(null, eachInput)
.
for each input without corresponding expected object.
If there are any differences between expected objects and input objects, the resulting list includes them.
input
- the input to verifyIOException
- if failed to obtain model objects from the input,
or the input key is already presentedIllegalArgumentException
- if some parameters were null
inspectRest()
public List<Difference> inspectRest()
This engine invokes
VerifyRule.verifyModel(eachExpected, null)
for each expected data objects, and clears them from this engine.
Note that the rest of expected data mean "expected but appeared in input."
You should invoke inspectInput(DataModelSource)
for each input before invoke this method.
inspectInput(DataModelSource)
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.