Package io.github.brantunger.unruly.test
Class ExpressionLanguageContractTest.WritableApplicant
java.lang.Object
io.github.brantunger.unruly.test.ExpressionLanguageContractTest.WritableApplicant
- Enclosing class:
ExpressionLanguageContractTest
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 -
Method Summary
Modifier and TypeMethodDescriptionintReturns the applicant's credit score.voidsetCreditScore(int creditScore) Sets the applicant's credit score, which no condition may do.toString()Returns the applicant asWritableApplicant[creditScore=750], so that a failure that names the fact says what it held.
-
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
Returns the applicant asWritableApplicant[creditScore=750], so that a failure that names the fact says what it held.
-