SWE/CS 332 In Class Exercise # 5


These exercises applies the contract model to JUnit tests. Work in groups.
Note: A few of you have experience with JUnit theories. Please join a group where others lack this experience.

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?