CC 410 - Week 3

Wrapping Up

  • Module 2: OOP
  • OOP Example
  • Restaurant 1

This Week

  • Documentation, Testing, UML
  • Doc & Testing Example
  • Restaurant 2

Milestone 2

  • Unit Tests (~400)
  • Documentation Comments
  • UML Class Diagram
  • 3-8 hours
  • ~3500-4000 LOC
  • Feedback welcome!

Milestone 2 Hints

  • Do Not Look at Source!
  • Use Global Attributes
  • Generalize (but not ingredients)
  • Look at Enum Parameterized Tests

Generalized Tests

Python
class TestTheRiker:
PRICE: float = 17.01 CALORIES: int = 1701
def test_has_correct_price(self) -> None: """The price is correct.""" item: TheRiker = TheRiker() assert_that(item.price, is_(TestTheRiker.PRICE))
def test_has_correct_calories(self) -> None: """The calories is correct.""" item: TheRiker = TheRiker() assert_that(item.calories, is_(TestTheRiker.CALORIES))
Java
public class TheRikerTest {
private static final double PRICE = 17.01; private static final int CALORIES = 1701;
/** * The price is correct. */ @Test public void testHasCorrectPrice() { TheRiker item = new TheRiker(); assertThat(item.getPrice(), is(PRICE)); }
/** * The calories is correct. */ @Test public void testHasCorrectCalories() { TheRiker item = new TheRiker(); assertThat(item.getCalories(), is(CALORIES)); } }

Looking Ahead

  • Module 4 - Inheritance
  • Module 5 - Debugging
    Final Project 2
  • NEW Module 6 - Design Patterns
  • NEW Module 7 - Test Doubles
  • GUIs, Web, etc.

Image Credit: Giphy