Package randoop.test
Class ErrorRevealingChecks
java.lang.Object
randoop.test.ErrorRevealingChecks
- All Implemented Interfaces:
TestChecks<ErrorRevealingChecks>
ErrorRevealingChecks represent failing checks for a particular test sequence. Each check may
refer to different variables defined in the sequence, so can only be assumed to be valid at the
end of the sequence. Note that there are no expected exceptions in error-revealing tests, and so
there should be no
ExceptionCheck
objects.-
Field Summary
Modifier and TypeFieldDescriptionstatic final ErrorRevealingChecks
An empty, immutable set of error-revealing checks. -
Constructor Summary
ConstructorDescriptionCreate an empty set of error checks.ErrorRevealingChecks
(Check check) Create a singleton set of error checks. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a check to this set.checks()
Get all non-exception checks and whether they are passing for this object.commonChecks
(ErrorRevealingChecks other) Returns the intersection of checks in this set and another set.int
count()
Return the number of checks in this test.boolean
Return the exception check in this object if there is one.boolean
Indicates whether this object has checks.boolean
Indicate whether this object has any failing checks.int
hashCode()
boolean
Indicates whether this set of checks contains any invalid behaviors.toString()
private static void
validateCheck
(Check check) Throw an exception ifcheck
is not acceptable for this class.
-
Field Details
-
EMPTY
An empty, immutable set of error-revealing checks. -
checks
-
-
Constructor Details
-
ErrorRevealingChecks
public ErrorRevealingChecks()Create an empty set of error checks. -
ErrorRevealingChecks
Create a singleton set of error checks.- Parameters:
check
- the check to put in the newly-created singleton set
-
-
Method Details
-
validateCheck
Throw an exception ifcheck
is not acceptable for this class.- Parameters:
check
- the check that a client is trying to insert into this
-
count
public int count()Description copied from interface:TestChecks
Return the number of checks in this test.- Specified by:
count
in interfaceTestChecks<ErrorRevealingChecks>
- Returns:
- the count of checks in this object
-
checks
Get all non-exception checks and whether they are passing for this object.- Specified by:
checks
in interfaceTestChecks<ErrorRevealingChecks>
- Returns:
- all checks, with each mapped to false, indicating it is failing
-
hasChecks
public boolean hasChecks()Indicates whether this object has checks.- Specified by:
hasChecks
in interfaceTestChecks<ErrorRevealingChecks>
- Returns:
- true if not empty
-
hasErrorBehavior
public boolean hasErrorBehavior()Indicate whether this object has any failing checks. (This is essentially asking whether this is an error revealing test.)- Specified by:
hasErrorBehavior
in interfaceTestChecks<ErrorRevealingChecks>
- Returns:
- true if there are any error revealing checks (not empty)
-
getExceptionCheck
Return the exception check in this object if there is one.- Specified by:
getExceptionCheck
in interfaceTestChecks<ErrorRevealingChecks>
- Returns:
- null, since no expected exceptions in error-revealing tests
-
add
Add a check to this set.- Specified by:
add
in interfaceTestChecks<ErrorRevealingChecks>
- Parameters:
check
- the check object to add to this set of checks- Throws:
Error
- ifcheck
is an exception check
-
equals
-
hashCode
public int hashCode() -
commonChecks
Description copied from interface:TestChecks
Returns the intersection of checks in this set and another set.- Specified by:
commonChecks
in interfaceTestChecks<ErrorRevealingChecks>
- Parameters:
other
- theTestChecks
to compare with- Returns:
- the checks common to this set of checks and those in
other
-
hasInvalidBehavior
public boolean hasInvalidBehavior()Indicates whether this set of checks contains any invalid behaviors.Returns false because error checks are not considered invalid.
- Specified by:
hasInvalidBehavior
in interfaceTestChecks<ErrorRevealingChecks>
- Returns:
- false, always
-
toString
-