| layout | page |
|---|---|
| title | 401.13 Reading Notes |
| permalink | /401-R13/ |
-
Using the annotation
@OneToOnewithin each class (before an instance of the related class), two classes may be related.- Additional annotations (like
@RestResource) may be included to further define the relationship.
- Additional annotations (like
-
Respective repository interfaces must be made for each.
-
CRUD requests may be made with respect to the related resource.
-
Tested by POST-ing two objects, then PUT-ing the association. (GET the resulting resources)
-
Using the two respective annotations
@OneToManyand@ManyToOnebefore an instance of the related class, multiple resources may be related to a single resource. -
CRUD requests may be made with respect to the related resource to both associate an instance (PUT) and to GET the associated resources.
-
Tested by POST-ing more than two objects, the PUT-ing the same relationship to the first with each other (respectively)
- Using the annotation
@ManyToMany, individual instances of one resource may be associated with multiple others (including webbed relationships)
-
Integration testing is used to verify that resources have the expected relationships and interactions. (Some documentation here)
-
The annotations
@ExtendWith(),@ContextConfiguration(), and@WebAppConfigurationset up the testing context for the given classes to simulate relationships and associated behaviors