public class ErrorRevealingChecks extends java.lang.Object implements TestChecks<ErrorRevealingChecks>
ExceptionCheck
objects.Modifier and Type | Field and Description |
---|---|
private java.util.Set<Check> |
checks |
static ErrorRevealingChecks |
EMPTY
An empty, immutable set of error-revealing checks.
|
Constructor and Description |
---|
ErrorRevealingChecks()
Create an empty set of error checks.
|
ErrorRevealingChecks(Check check)
Create a singleton set of error checks.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Check check)
Add a check to this set.
|
java.util.Set<Check> |
checks()
Get all non-exception checks and whether they are passing for this object.
|
ErrorRevealingChecks |
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 |
equals(@Nullable java.lang.Object obj) |
ExceptionCheck |
getExceptionCheck()
Return the exception check in this object if there is one.
|
boolean |
hasChecks()
Indicates whether this object has checks.
|
boolean |
hasErrorBehavior()
Indicate whether this object has any failing checks.
|
int |
hashCode() |
boolean |
hasInvalidBehavior()
Indicates whether this set of checks contains any invalid behaviors.
|
java.lang.String |
toString() |
private static void |
validateCheck(Check check)
Throw an exception if
check is not acceptable for this class. |
public static final ErrorRevealingChecks EMPTY
private java.util.Set<Check> checks
public ErrorRevealingChecks()
public ErrorRevealingChecks(Check check)
check
- the check to put in the newly-created singleton setprivate static void validateCheck(Check check)
check
is not acceptable for this class.check
- the check that a client is trying to insert into thispublic int count()
TestChecks
count
in interface TestChecks<ErrorRevealingChecks>
public java.util.Set<Check> checks()
checks
in interface TestChecks<ErrorRevealingChecks>
public boolean hasChecks()
hasChecks
in interface TestChecks<ErrorRevealingChecks>
public boolean hasErrorBehavior()
hasErrorBehavior
in interface TestChecks<ErrorRevealingChecks>
public ExceptionCheck getExceptionCheck()
getExceptionCheck
in interface TestChecks<ErrorRevealingChecks>
public void add(Check check)
add
in interface TestChecks<ErrorRevealingChecks>
check
- the check object to add to this set of checksjava.lang.Error
- if check
is an exception checkpublic boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public ErrorRevealingChecks commonChecks(ErrorRevealingChecks other)
TestChecks
commonChecks
in interface TestChecks<ErrorRevealingChecks>
other
- the TestChecks
to compare withother
public boolean hasInvalidBehavior()
Returns false because error checks are not considered invalid.
hasInvalidBehavior
in interface TestChecks<ErrorRevealingChecks>
public java.lang.String toString()
toString
in class java.lang.Object