SWE 437 In Class Exercise # 4
JUnit Theories

Instructions: Work with your neighbors in groups.

  1. Consider the contract for the equals() method.
    Which aspects of this contract are suitable for implementation as JUnit theories?
  2. Implement each suitable contract clause. with the Assume, Act, Assert model.
  3. Which @Datapoints are especially of interest for each clause?
  4. For a given @Datapoints choice, how often does execution reach various parts of the JUnit theory?

Note: This exercise may look trivial, but almost certainly everyone in this classroom (including me!) has written code that violates at least one of the theories we will develop.