public class ThrowsIfViolation
extends AssertionViolation
Thrown whenever a @ThrowsIf exceptional-contract violation is detected
by a checked arm-set: the method returned normally although a
must-throw condition held, or threw a matching exception although no arm's
condition held (the latter checked only for exhaustive arm-sets).
Deliberately not the arm's declared exception: the declared exception is defined behaviour delivered at method entry, whereas this violation reports a broken implementation of the contract — late-throwing the declared exception would masquerade the bug as defined behaviour.
| Constructor and description |
|---|
ThrowsIfViolation()Creates a throws-if violation without an explicit detail message. |
ThrowsIfViolation(Object o)Creates a throws-if violation with an object-valued detail. |
ThrowsIfViolation(boolean b)Creates a throws-if violation with a boolean detail. |
ThrowsIfViolation(char c)Creates a throws-if violation with a char detail. |
ThrowsIfViolation(int i)Creates a throws-if violation with an int detail. |
ThrowsIfViolation(long l)Creates a throws-if violation with a long detail. |
ThrowsIfViolation(float f)Creates a throws-if violation with a float detail. |
ThrowsIfViolation(double d)Creates a throws-if violation with a double detail. |
Creates a throws-if violation without an explicit detail message.
Creates a throws-if violation with an object-valued detail.
o - the detail objectCreates a throws-if violation with a boolean detail.
b - the detail valueCreates a throws-if violation with a char detail.
c - the detail valueCreates a throws-if violation with an int detail.
i - the detail valueCreates a throws-if violation with a long detail.
l - the detail valueCreates a throws-if violation with a float detail.
f - the detail valueCreates a throws-if violation with a double detail.
d - the detail valueCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.