---
# (DD02) Business Logic — OwnerControllerTests.george() [18 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `org.springframework.samples.petclinic.owner.OwnerControllerTests` |
| Layer | Test Utility / Controller Test Fixture |
| Module | `owner` (Package: `org.springframework.samples.petclinic.owner`) |

## 1. Role

### OwnerControllerTests.george()

This method is a test fixture builder that creates a fully populated `Owner` domain object representing the sample customer George Franklin and his pet Max. It exists to supply consistent, reusable test data for owner-controller scenarios, especially read-path assertions and mocked repository responses that need a realistic owner aggregate rather than an empty stub.

Business-wise, it prepares the canonical PetClinic owner profile: identity, contact information, and one associated pet with a pet type and birth date. The method follows a builder-style construction pattern by instantiating the aggregate root, populating scalar fields, creating a nested `Pet` and `PetType`, and then attaching the pet to the owner through the domain relationship. It does not branch or dispatch across business cases; instead, it deterministically assembles one standard owner record used throughout the test class as shared sample data.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["george()"])
    CREATE_OWNER["Create Owner instance"]
    SET_ID["Set owner id to TEST_OWNER_ID"]
    SET_FIRST["Set first name to George"]
    SET_LAST["Set last name to Franklin"]
    SET_ADDRESS["Set address to 110 W. Liberty St."]
    SET_CITY["Set city to Madison"]
    SET_PHONE["Set telephone to 6085551023"]
    CREATE_PET["Create Pet max"]
    CREATE_TYPE["Create PetType dog"]
    SET_TYPE_NAME["Set pet type name to dog"]
    ASSIGN_TYPE["Assign type to pet"]
    SET_PET_NAME["Set pet name to Max"]
    SET_BIRTH["Set pet birth date to LocalDate.now()"]
    ADD_PET["Add pet to owner"]
    SET_PET_ID["Set pet id to 1"]
    RETURN_OWNER["Return owner"]
    START --> CREATE_OWNER
    CREATE_OWNER --> SET_ID
    SET_ID --> SET_FIRST
    SET_FIRST --> SET_LAST
    SET_LAST --> SET_ADDRESS
    SET_ADDRESS --> SET_CITY
    SET_CITY --> SET_PHONE
    SET_PHONE --> CREATE_PET
    CREATE_PET --> CREATE_TYPE
    CREATE_TYPE --> SET_TYPE_NAME
    SET_TYPE_NAME --> ASSIGN_TYPE
    ASSIGN_TYPE --> SET_PET_NAME
    SET_PET_NAME --> SET_BIRTH
    SET_BIRTH --> ADD_PET
    ADD_PET --> SET_PET_ID
    SET_PET_ID --> RETURN_OWNER
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | - |

External state read by the method:
- `TEST_OWNER_ID` instance or class constant used as the owner identifier.
- `LocalDate.now()` as the runtime date source for the pet's birth date.
- Domain constructors and mutators from `Owner`, `Pet`, and `PetType`.

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `OwnerControllerTests.george` | OwnerControllerTests | - | Calls `george` in `OwnerControllerTests` |

Analyze all method calls within this method and classify each as a CRUD operation.
Use the pre-computed evidence above. If SC Code or Entity/DB is missing, try to infer from:
- The **SC Code** (Service Component code, e.g., `EKK0361A010SC`, `EKK1081D010CBS`) — look at the class name of the called method or its containing class.
- The **Entity/DB tables** — search for table name constants (often `KK_T_*` pattern), SQL references, or entity names in the called method.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `Owner` / `Pet` / `PetType` constructors and setters | OwnerControllerTests | In-memory test fixture objects | Creates an owner aggregate and nested pet data for controller test setup |
| U | `setId`, `setFirstName`, `setLastName`, `setAddress`, `setCity`, `setTelephone`, `setType`, `setName`, `setBirthDate`, `addPet` | OwnerControllerTests | Owner / Pet / PetType domain objects | Populates and links domain fields to form a realistic sample owner record |
| U | `LocalDate.now()` | OwnerControllerTests | Current system date | Supplies the pet birth date used in the fixture |

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 3 methods.
Terminal operations from this method: `george` [-], `george` [-], `george` [-], `george` [-], `george` [-], `george` [-], `george` [-]

Trace who calls this method and what this method ultimately calls.
Use the pre-computed evidence and caller search results from Step 2 above.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Controller test setup | `OwnerControllerTests.setup` -> `OwnerControllerTests.george` | `Owner aggregate fixture [C/U] Owner` |
| 2 | Controller test methods | `OwnerControllerTests.<test methods>` -> `OwnerControllerTests.george` | `Owner aggregate fixture [C/U] Owner` |
| 3 | Controller test assertions | `OwnerControllerTests.<test methods>` -> `OwnerControllerTests.george` | `Owner aggregate fixture [C/U] Owner` |

## 6. Per-Branch Detail Blocks

**Block 1** — [SEQUENTIAL] `(method body)` (L71)

> Builds the canonical owner test fixture in a fixed order.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Owner george = new Owner();` |
| 2 | EXEC | `george.setId(TEST_OWNER_ID);` |
| 3 | EXEC | `george.setFirstName("George");` |
| 4 | EXEC | `george.setLastName("Franklin");` |
| 5 | EXEC | `george.setAddress("110 W. Liberty St.");` |
| 6 | EXEC | `george.setCity("Madison");` |
| 7 | EXEC | `george.setTelephone("6085551023");` |
| 8 | SET | `Pet max = new Pet();` |
| 9 | SET | `PetType dog = new PetType();` |
| 10 | EXEC | `dog.setName("dog");` |
| 11 | EXEC | `max.setType(dog);` |
| 12 | EXEC | `max.setName("Max");` |
| 13 | EXEC | `max.setBirthDate(LocalDate.now());` |
| 14 | CALL | `george.addPet(max);` |
| 15 | EXEC | `max.setId(1);` |
| 16 | RETURN | `return george;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `Owner` | Domain object | Pet owner aggregate used by the clinic to store customer identity and contact information |
| `Pet` | Domain object | Animal record linked to an owner in the clinic system |
| `PetType` | Domain object | Classification of a pet such as dog or cat |
| `TEST_OWNER_ID` | Constant | Stable test identifier used to reference the sample owner in controller tests |
| `george` | Fixture helper | Local test-data factory method that returns the standard George Franklin owner record |
| `firstName` | Field | Owner's given name |
| `lastName` | Field | Owner's family name |
| `address` | Field | Owner's street address |
| `city` | Field | Owner's city of residence |
| `telephone` | Field | Owner's contact phone number |
| `birthDate` | Field | Pet's date of birth used for business validation and display |
| `addPet` | Domain method | Associates a pet with its owner aggregate |
| `LocalDate.now()` | Technical API | Current system date used to create a realistic birth date in the fixture |
| `George Franklin` | Business term | Canonical sample owner identity used across PetClinic examples and tests |
| `Max` | Business term | Canonical sample pet name attached to George Franklin |
| `dog` | Business term | Sample pet type representing a dog |
