SWE/CS 332 In Class Exercise # 5
September 13, 2017


These exercises applies the contract model to JUnit tests. Work in groups.

As we noticed in our first in-class exercise, the equals() method is required to satisfy certain relationships.

  1. Identify some of these relationships.

  2. Write a JUnit theory that captures one of these properties.

  3. Concoct a Java class that violates this property.

  4. Populate the theory with appropriate data points (ignore JUnit syntax)

  5. How many tests does your theory consider?

  6. How many tests pass the precondition for your theory?

  7. How many tests pass (or fail) the postcondition for your theory?