Interface SingleConstraintAssertion
-
- All Known Implementing Classes:
DefaultSingleConstraintAssertion
public interface SingleConstraintAssertion
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
penalizes()
Asserts that theConstraint
being tested, given a set of facts, results in any number of penalties.default void
penalizes(long times)
Asserts that theConstraint
being tested, given a set of facts, results in a given number of penalties.void
penalizes(long times, String message)
As defined bypenalizes(long)
.void
penalizes(String message)
As defined bypenalizes()
.default void
penalizesBy(int matchWeightTotal)
Asserts that theConstraint
being tested, given a set of facts, results in a specific penalty.void
penalizesBy(int matchWeightTotal, String message)
As defined bypenalizesBy(int)
.default void
penalizesBy(long matchWeightTotal)
As defined bypenalizesBy(int)
.void
penalizesBy(long matchWeightTotal, String message)
As defined bypenalizesBy(int)
.default void
penalizesBy(BigDecimal matchWeightTotal)
As defined bypenalizesBy(int)
.void
penalizesBy(BigDecimal matchWeightTotal, String message)
As defined bypenalizesBy(int)
.default void
rewards()
Asserts that theConstraint
being tested, given a set of facts, results in any number of rewards.default void
rewards(long times)
Asserts that theConstraint
being tested, given a set of facts, results in a given number of rewards.void
rewards(long times, String message)
As defined byrewards(long)
.void
rewards(String message)
As defined byrewards()
.default void
rewardsWith(int matchWeightTotal)
Asserts that theConstraint
being tested, given a set of facts, results in a specific reward.void
rewardsWith(int matchWeightTotal, String message)
As defined byrewardsWith(int)
.default void
rewardsWith(long matchWeightTotal)
As defined byrewardsWith(int)
.void
rewardsWith(long matchWeightTotal, String message)
As defined byrewardsWith(int)
.default void
rewardsWith(BigDecimal matchWeightTotal)
As defined byrewardsWith(int)
.void
rewardsWith(BigDecimal matchWeightTotal, String message)
As defined byrewardsWith(int)
.
-
-
-
Method Detail
-
penalizesBy
default void penalizesBy(int matchWeightTotal)
Asserts that theConstraint
being tested, given a set of facts, results in a specific penalty.Ignores the constraint weight: it only asserts the match weights. For example: a match with a match weight of
10
on a constraint with a constraint weight of-2hard
reduces the score by-20hard
. In that case, this assertion checks for10
.An
int matchWeightTotal
automatically casts tolong
forlong scores
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.- Throws:
AssertionError
- when the expected penalty is not observed
-
penalizesBy
void penalizesBy(int matchWeightTotal, String message)
As defined bypenalizesBy(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.message
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when the expected penalty is not observed
-
penalizesBy
default void penalizesBy(long matchWeightTotal)
As defined bypenalizesBy(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.- Throws:
AssertionError
- when the expected penalty is not observed
-
penalizesBy
void penalizesBy(long matchWeightTotal, String message)
As defined bypenalizesBy(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.message
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when the expected penalty is not observed
-
penalizesBy
default void penalizesBy(BigDecimal matchWeightTotal)
As defined bypenalizesBy(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.- Throws:
AssertionError
- when the expected penalty is not observed
-
penalizesBy
void penalizesBy(BigDecimal matchWeightTotal, String message)
As defined bypenalizesBy(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.message
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when the expected penalty is not observed
-
penalizes
default void penalizes(long times)
Asserts that theConstraint
being tested, given a set of facts, results in a given number of penalties.Ignores the constraint and match weights: it only asserts the number of matches For example: if there are two matches with weight of
10
each, this assertion will check for 2 matches.- Parameters:
times
- at least 0, expected number of times that the constraint will penalize- Throws:
AssertionError
- when the expected penalty is not observed
-
penalizes
void penalizes(long times, String message)
As defined bypenalizes(long)
.- Parameters:
times
- at least 0, expected number of times that the constraint will penalizemessage
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when the expected penalty is not observed
-
penalizes
default void penalizes()
Asserts that theConstraint
being tested, given a set of facts, results in any number of penalties.Ignores the constraint and match weights: it only asserts the number of matches For example: if there are two matches with weight of
10
each, this assertion will succeed. If there are no matches, it will fail.- Throws:
AssertionError
- when there are no penalties
-
penalizes
void penalizes(String message)
As defined bypenalizes()
.- Parameters:
message
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when there are no penalties
-
rewardsWith
default void rewardsWith(int matchWeightTotal)
Asserts that theConstraint
being tested, given a set of facts, results in a specific reward.Ignores the constraint weight: it only asserts the match weights. For example: a match with a match weight of
10
on a constraint with a constraint weight of-2hard
reduces the score by-20hard
. In that case, this assertion checks for10
.An
int matchWeightTotal
automatically casts tolong
forlong scores
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.- Throws:
AssertionError
- when the expected reward is not observed
-
rewardsWith
void rewardsWith(int matchWeightTotal, String message)
As defined byrewardsWith(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.message
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when the expected reward is not observed
-
rewardsWith
default void rewardsWith(long matchWeightTotal)
As defined byrewardsWith(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.- Throws:
AssertionError
- when the expected reward is not observed
-
rewardsWith
void rewardsWith(long matchWeightTotal, String message)
As defined byrewardsWith(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.message
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when the expected reward is not observed
-
rewardsWith
default void rewardsWith(BigDecimal matchWeightTotal)
As defined byrewardsWith(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.- Throws:
AssertionError
- when the expected reward is not observed
-
rewardsWith
void rewardsWith(BigDecimal matchWeightTotal, String message)
As defined byrewardsWith(int)
.- Parameters:
matchWeightTotal
- at least 0, expected sum of match weights of matches of the constraint.message
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when the expected reward is not observed
-
rewards
default void rewards(long times)
Asserts that theConstraint
being tested, given a set of facts, results in a given number of rewards.Ignores the constraint and match weights: it only asserts the number of matches For example: if there are two matches with weight of
10
each, this assertion will check for 2 matches.- Parameters:
times
- at least 0, expected number of times that the constraint will reward- Throws:
AssertionError
- when the expected reward is not observed
-
rewards
void rewards(long times, String message)
As defined byrewards(long)
.- Parameters:
times
- at least 0, expected number of times that the constraint will rewardmessage
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when the expected reward is not observed
-
rewards
default void rewards()
Asserts that theConstraint
being tested, given a set of facts, results in any number of rewards.Ignores the constraint and match weights: it only asserts the number of matches For example: if there are two matches with weight of
10
each, this assertion will succeed. If there are no matches, it will fail.- Throws:
AssertionError
- when there are no rewards
-
rewards
void rewards(String message)
As defined byrewards()
.- Parameters:
message
- sometimes null, description of the scenario being asserted- Throws:
AssertionError
- when there are no rewards
-
-