It seemed to me that I understand CodePro contracts, but they don't seem to have any effect. For instance:
public class ContractTest {
private int number;
public void setNumber(int inputNumber) {
number = inputNumber;
}
public int getNumber() {
return number;
}
public static void main(String args[]) {
ConditionsTest conditionsTest = new ConditionsTest();
conditionsTest.setNumber(-5);
System.out.println("Number: " + conditionsTest.getNumber());
}
}
Running the main (String []) method calls:
number: -5
for print. There were no compilation warnings (expected), and there were no exceptions. In addition, contracts for junit test methods created by CodePro were not affected by the contracts.
So how do you use CodePro contracts?
source
share