Class ExpressionLanguageContractTest.WritableApplicant

java.lang.Object
io.github.brantunger.unruly.test.ExpressionLanguageContractTest.WritableApplicant
Enclosing class:
ExpressionLanguageContractTest

public static final class ExpressionLanguageContractTest.WritableApplicant extends Object
An applicant as a JavaBean with a setter, so a language's tests can run a rule against a fact whose property a condition could write. conditionWritesRejected requires its credit score unchanged after a condition that writes it. It's public, with a public setter, so that a language that calls a bean's setter, by reflection or however else, can reach it: one it couldn't reach would fail the write, and pass the check, for that reason. It has no equals or hashCode: the check looks at the one instance it gave the run.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WritableApplicant(int creditScore)
    Creates the applicant.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the applicant's credit score.
    void
    setCreditScore(int creditScore)
    Sets the applicant's credit score, which no condition may do.
    Returns the applicant as WritableApplicant[creditScore=750], so that a failure that names the fact says what it held.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • WritableApplicant

      public WritableApplicant(int creditScore)
      Creates the applicant.
      Parameters:
      creditScore - The applicant's credit score, the property the contract test writes
  • Method Details

    • getCreditScore

      public int getCreditScore()
      Returns the applicant's credit score.
      Returns:
      The credit score
    • setCreditScore

      public void setCreditScore(int creditScore)
      Sets the applicant's credit score, which no condition may do.
      Parameters:
      creditScore - The credit score
    • toString

      public String toString()
      Returns the applicant as WritableApplicant[creditScore=750], so that a failure that names the fact says what it held.
      Overrides:
      toString in class Object
      Returns:
      The applicant's description