Interface SingleConstraintAssertion

All Known Subinterfaces:
ShadowVariableAwareSingleConstraintAssertion
All Known Implementing Classes:
AbstractSingleConstraintAssertion, DefaultShadowVariableAwareSingleConstraintAssertion, DefaultSingleConstraintAssertion

public interface SingleConstraintAssertion
  • Method Details

    • justifiesWith

      @NonNull SingleConstraintAssertion justifiesWith(@Nullable String message, @NonNull ConstraintJustification @NonNull ... justifications)
      Parameters:
      justifications - the expected justification.
      message - description of the scenario being asserted
      Throws:
      AssertionError - when the expected penalty is not observed
    • justifiesWith

      default @NonNull SingleConstraintAssertion justifiesWith(@NonNull ConstraintJustification @NonNull ... justifications)
      Asserts that the Constraint being tested, given a set of facts, results in a given ConstraintJustification.
      Parameters:
      justifications - the expected justifications.
      Throws:
      AssertionError - when the expected penalty is not observed
    • justifiesWithExactly

      @NonNull SingleConstraintAssertion justifiesWithExactly(@Nullable String message, @NonNull ConstraintJustification @NonNull ... justifications)
      Parameters:
      justifications - the expected justification.
      message - description of the scenario being asserted
      Throws:
      AssertionError - when the expected penalty is not observed
    • justifiesWithExactly

      default @NonNull SingleConstraintAssertion justifiesWithExactly(@NonNull ConstraintJustification @NonNull ... justifications)
      Asserts that the Constraint being tested, given a set of facts, results in a given ConstraintJustification and nothing else.
      Parameters:
      justifications - the expected justifications.
      Throws:
      AssertionError - when the expected penalty is not observed
    • indictsWith

      default @NonNull SingleConstraintAssertion indictsWith(@NonNull Object @NonNull ... indictments)
      Asserts that the Constraint being tested, given a set of facts, results in the given indictments.
      Parameters:
      indictments - the expected indictments.
      Throws:
      AssertionError - when the expected penalty is not observed
    • indictsWith

      @NonNull SingleConstraintAssertion indictsWith(@Nullable String message, @NonNull Object @NonNull ... indictments)
      As defined by indictsWith(Object...).
      Parameters:
      message - description of the scenario being asserted
      indictments - the expected indictments.
      Throws:
      AssertionError - when the expected penalty is not observed
    • indictsWithExactly

      default @NonNull SingleConstraintAssertion indictsWithExactly(@NonNull Object @NonNull ... indictments)
      Asserts that the Constraint being tested, given a set of facts, results in the given indictments and nothing else.
      Parameters:
      indictments - the expected indictments.
      Throws:
      AssertionError - when the expected penalty is not observed
    • indictsWithExactly

      @NonNull SingleConstraintAssertion indictsWithExactly(@Nullable String message, @NonNull Object @NonNull ... indictments)
      Parameters:
      message - description of the scenario being asserted
      indictments - the expected indictments.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesBy

      default void penalizesBy(int matchWeightTotal)
      Asserts that the Constraint 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 for 10.

      An int matchWeightTotal automatically casts to long for long 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

      @Deprecated(forRemoval=true, since="1.8.0") default void penalizesBy(int matchWeightTotal, String message)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As defined by penalizesBy(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

      void penalizesBy(@Nullable String message, int matchWeightTotal)
      As defined by penalizesBy(int).
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesBy

      default void penalizesBy(long matchWeightTotal)
      As defined by penalizesBy(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

      @Deprecated(forRemoval=true, since="1.8.0") default void penalizesBy(long matchWeightTotal, String message)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As defined by penalizesBy(long).
      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

      void penalizesBy(@Nullable String message, long matchWeightTotal)
      As defined by penalizesBy(long).
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesBy

      default void penalizesBy(@NonNull BigDecimal matchWeightTotal)
      As defined by penalizesBy(long).
      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

      @Deprecated(forRemoval=true, since="1.8.0") default void penalizesBy(BigDecimal matchWeightTotal, String message)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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

      void penalizesBy(@Nullable String message, @NonNull BigDecimal matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizes

      default void penalizes(long times)
      Asserts that the Constraint 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

      @Deprecated(forRemoval=true, since="1.8.0") default void penalizes(long times, String message)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As defined by penalizes(long).
      Parameters:
      times - at least 0, expected number of times that the constraint will penalize
      message - sometimes null, description of the scenario being asserted
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizes

      void penalizes(@Nullable String message, long times)
      As defined by penalizes(long).
      Parameters:
      message - description of the scenario being asserted
      times - at least 0, expected number of times that the constraint will penalize
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizes

      default void penalizes()
      Asserts that the Constraint 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(@Nullable String message)
      As defined by penalizes().
      Parameters:
      message - description of the scenario being asserted
      Throws:
      AssertionError - when there are no penalties
    • rewardsWith

      default void rewardsWith(int matchWeightTotal)
      Asserts that the Constraint 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 for 10.

      An int matchWeightTotal automatically casts to long for long 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

      @Deprecated(forRemoval=true, since="1.8.0") default void rewardsWith(int matchWeightTotal, String message)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As defined by rewardsWith(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

      void rewardsWith(@Nullable String message, int matchWeightTotal)
      As defined by rewardsWith(int).
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWith

      default void rewardsWith(long matchWeightTotal)
      As defined by rewardsWith(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

      @Deprecated(forRemoval=true, since="1.8.0") default void rewardsWith(long matchWeightTotal, String message)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As defined by rewardsWith(long).
      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

      void rewardsWith(@Nullable String message, long matchWeightTotal)
      As defined by rewardsWith(long).
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWith

      default void rewardsWith(@NonNull BigDecimal matchWeightTotal)
      As defined by rewardsWith(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

      @Deprecated(forRemoval=true, since="1.8.0") default void rewardsWith(BigDecimal matchWeightTotal, String message)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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

      void rewardsWith(@Nullable String message, @NonNull BigDecimal matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewards

      default void rewards(long times)
      Asserts that the Constraint 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

      @Deprecated(forRemoval=true, since="1.8.0") default void rewards(long times, String message)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As defined by rewards(long).
      Parameters:
      times - at least 0, expected number of times that the constraint will reward
      message - sometimes null, description of the scenario being asserted
      Throws:
      AssertionError - when the expected reward is not observed
    • rewards

      void rewards(@Nullable String message, long times)
      As defined by rewards(long).
      Parameters:
      message - description of the scenario being asserted
      times - at least 0, expected number of times that the constraint will reward
      Throws:
      AssertionError - when the expected reward is not observed
    • rewards

      default void rewards()
      Asserts that the Constraint 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(@Nullable String message)
      As defined by rewards().
      Parameters:
      message - description of the scenario being asserted
      Throws:
      AssertionError - when there are no rewards
    • penalizesByMoreThan

      default void penalizesByMoreThan(int matchWeightTotal)
      Asserts that the Constraint being tested, given a set of facts, results in a specific penalty larger than given.

      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 for 10.

      An int matchWeightTotal automatically casts to long for long 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
    • penalizesByMoreThan

      void penalizesByMoreThan(@Nullable String message, int matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesByMoreThan

      default void penalizesByMoreThan(long matchWeightTotal)
      Parameters:
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesByMoreThan

      void penalizesByMoreThan(@Nullable String message, long matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesByMoreThan

      default void penalizesByMoreThan(@NonNull BigDecimal matchWeightTotal)
      Parameters:
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesByMoreThan

      void penalizesByMoreThan(@Nullable String message, @NonNull BigDecimal matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesMoreThan

      default void penalizesMoreThan(long times)
      Asserts that the Constraint being tested, given a set of facts, results in a number of rewards larger than given.

      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
    • penalizesMoreThan

      void penalizesMoreThan(@Nullable String message, long times)
      Parameters:
      message - description of the scenario being asserted
      times - at least 0, expected number of times that the constraint will penalize
      Throws:
      AssertionError - when the expected penalty is not observed
    • rewardsWithMoreThan

      default void rewardsWithMoreThan(int matchWeightTotal)
      Asserts that the Constraint being tested, given a set of facts, results in a specific reward larger than given.

      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 for 10.

      An int matchWeightTotal automatically casts to long for long 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
    • rewardsWithMoreThan

      void rewardsWithMoreThan(@Nullable String message, int matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWithMoreThan

      default void rewardsWithMoreThan(long matchWeightTotal)
      Parameters:
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWithMoreThan

      void rewardsWithMoreThan(@Nullable String message, long matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWithMoreThan

      default void rewardsWithMoreThan(@NonNull BigDecimal matchWeightTotal)
      Parameters:
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWithMoreThan

      void rewardsWithMoreThan(@Nullable String message, @NonNull BigDecimal matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 0, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsMoreThan

      default void rewardsMoreThan(long times)
      Asserts that the Constraint being tested, given a set of facts, results in a number of rewards larger than given.

      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
    • rewardsMoreThan

      void rewardsMoreThan(@Nullable String message, long times)
      As defined by rewardsMoreThan(long).
      Parameters:
      message - description of the scenario being asserted
      times - at least 0, expected number of times that the constraint will reward
      Throws:
      AssertionError - when the expected reward is not observed
    • penalizesByLessThan

      default void penalizesByLessThan(int matchWeightTotal)
      Asserts that the Constraint being tested, given a set of facts, results in a specific penalty smaller than given.

      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 for 10.

      An int matchWeightTotal automatically casts to long for long scores.

      Parameters:
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesByLessThan

      void penalizesByLessThan(@Nullable String message, int matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesByLessThan

      default void penalizesByLessThan(long matchWeightTotal)
      Parameters:
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesByLessThan

      void penalizesByLessThan(@Nullable String message, long matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesByLessThan

      default void penalizesByLessThan(@NonNull BigDecimal matchWeightTotal)
      Parameters:
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesByLessThan

      void penalizesByLessThan(@Nullable String message, @NonNull BigDecimal matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesLessThan

      default void penalizesLessThan(long times)
      Asserts that the Constraint being tested, given a set of facts, results in a number of rewards smaller than given.

      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 1, expected number of times that the constraint will penalize
      Throws:
      AssertionError - when the expected penalty is not observed
    • penalizesLessThan

      void penalizesLessThan(@Nullable String message, long times)
      Parameters:
      message - description of the scenario being asserted
      times - at least 1, expected number of times that the constraint will penalize
      Throws:
      AssertionError - when the expected penalty is not observed
    • rewardsWithLessThan

      default void rewardsWithLessThan(int matchWeightTotal)
      Asserts that the Constraint being tested, given a set of facts, results in a specific reward smaller than given.

      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 for 10.

      An int matchWeightTotal automatically casts to long for long scores.

      Parameters:
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWithLessThan

      void rewardsWithLessThan(@Nullable String message, int matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWithLessThan

      default void rewardsWithLessThan(long matchWeightTotal)
      Parameters:
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWithLessThan

      void rewardsWithLessThan(@Nullable String message, long matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWithLessThan

      default void rewardsWithLessThan(@NonNull BigDecimal matchWeightTotal)
      Parameters:
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsWithLessThan

      void rewardsWithLessThan(@Nullable String message, @NonNull BigDecimal matchWeightTotal)
      Parameters:
      message - description of the scenario being asserted
      matchWeightTotal - at least 1, expected sum of match weights of matches of the constraint.
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsLessThan

      default void rewardsLessThan(long times)
      Asserts that the Constraint being tested, given a set of facts, results in a number of rewards smaller than given.

      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 1, expected number of times that the constraint will reward
      Throws:
      AssertionError - when the expected reward is not observed
    • rewardsLessThan

      void rewardsLessThan(@Nullable String message, long times)
      As defined by rewardsLessThan(long).
      Parameters:
      message - description of the scenario being asserted
      times - at least 1, expected number of times that the constraint will reward
      Throws:
      AssertionError - when the expected reward is not observed