T
- type of modelpublic interface ModelVerifier<T>
Modifier and Type | Method and Description |
---|---|
Object |
getKey(T target)
Returns the key of the target data model.
|
Object |
verify(T expected,
T actual)
Verifies each model object and returns error report.
|
Object getKey(T target)
This method must return objects which have
both Object.equals(Object)
and Object.hashCode()
.
example:
@Override Object getKey(T target) {
return Arrays.asList(target.getKey1(), target.getKey2());
}
target
- the targetIllegalArgumentException
- if some parameters were null
Object verify(T expected, T actual)
example:
@Override Object verify(T expected, T actual) {
if (expected == null) {
return "unexpected"; // unexpected results
} else if (actual == null) {
return null; // ignores unnecessary results
} else if (expected.getValue() != actual.getValue()) {
return "value"; // invalid
}
return null; // successfully verified
}
expected
- the expected model object,
or null
if there are no corresponded to the actual model objectactual
- the actual model object in test results,
or null
if there are no corresponded to the expected model objectnull
if successfully verifiedCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.