SE450: Comment on the use of Commands [5/5] Previous pageContents

Here is one scenario --- running an add command --- from line 31 of
myhw2.main.TEST1:

00029:     Video v1 = Data.newVideo("Title1", 2000, "Director1");
00031:     Assert.assertTrue(Data.newAddCmd(_inventory, v1, 5).run());

The objects involved are:

  +-----------+  +----------------+  +------------------+  +--------------+
  | t : TEST1 |  | c : CmdAdd     |  | i : InventorySet |  | v : VideoObj |
  | --------- |  | ----------     |  | ---------------- |  | ------------ |
  +-----------+  +----------------+  +------------------+  +--------------+
                 | inventory = i  |   
                 | video = v      |   
                 | change = 5     |
                 +----------------+

Execution proceeds as follows:

  t calls c.run();
  c calls i.addNumOwned(v,5)

Previous pageContents