A.3. User Interaction

User interaction fixtures appear in the main body of the test, for the "given" (to setup the rest of the state of the system, typically transactional objects), for the "when" (the interaction being tested) or the "then" (assertions on the state after the interaction being tested).

A.3.1. UsingNakedObjectsViewer / UsingNakedObjectsViewerForSetup

Simulates interacting with domain objects as if through a viewer. Interact with objects, check their state, alias referenced or returned objects.

The "ForSetup" version disables checks for visibility and usability, making it easier to reuse functionality for setting up objects prior to a test scenario (the "given"). The DebugObjectStore fixture (Section A.4.3, “DebugObjectStore”) can be used to check the state of objects created.

Example usage:

On properties:

On collections:

On actions:

On objects:

A.3.2. CheckList

Check items in list, either precisely or just for presence, using their title. Lists are either aliased results of actions, or aliased collections within objects.

Typically used in the "Then", though can be helpful as a way of confirming/documenting a "Given".

See also AliasItemsInList (Section A.3.3, “AliasItemsInList”), which also performs an implicit check (will fail if the objects are not in the list) and aliases them for further use.

A.3.3. AliasItemsInList

Allows an alias to be associated with items in a list. The list items are located by their title, and are presumed to exist. This fixture can therefore also be used as a way of checking for presence of items in a list (similar to CheckList, Section A.3.2, “CheckList”).

Typically used both in the "Given" (to simplify writing the rest of a test).