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

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

## 1. Role

### OwnerControllerTests.george()

The `george()` method is a test-data factory that constructs a fully populated `Owner` aggregate used by controller test cases in the PetClinic owner module. It creates a canonical business customer record for George Franklin, assigns a stable test identifier, and attaches a primary `Pet` record so downstream controller logic can exercise owner-and-pet scenarios without relying on external persistence. From a business perspective, this method prepares a realistic fixture representing an existing clinic customer with one registered pet, which is essential for validating owner display, search, and pagination behavior.

The method follows a simple object-initialization pattern: instantiate the owner, populate identity and contact fields, instantiate a pet and pet type, associate the pet with the owner, and finally return the aggregate. It does not branch, loop, or invoke any service-layer workflow; instead, it centralizes repeatable test setup so multiple controller tests can share the same canonical domain state. In the broader system, this method acts as a local test fixture builder for the owner controller test class, ensuring consistent sample data across the test suite.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["george()"])
    CREATE_OWNER["Create Owner instance"]
    SET_ID["setId(TEST_OWNER_ID)"]
    SET_FIRST["setFirstName(\"George\")"]
    SET_LAST["setLastName(\"Franklin\")"]
    SET_ADDR["setAddress(\"110 W. Liberty St.\")"]
    SET_CITY["setCity(\"Madison\")"]
    SET_PHONE["setTelephone(\"6085551023\")"]
    CREATE_PET["Create Pet instance"]
    CREATE_TYPE["Create PetType instance"]
    SET_TYPE_NAME["setName(\"dog\")"]
    SET_PET_TYPE["setType(dog)"]
    SET_PET_NAME["setName(\"Max\")"]
    SET_BIRTHDATE["setBirthDate(LocalDate.now())"]
    ADD_PET["george.addPet(max)"]
    SET_PET_ID["max.setId(1)"]
    RETURN_NODE["Return Owner"]
    START --> CREATE_OWNER
    CREATE_OWNER --> SET_ID
    SET_ID --> SET_FIRST
    SET_FIRST --> SET_LAST
    SET_LAST --> SET_ADDR
    SET_ADDR --> SET_CITY
    SET_CITY --> SET_PHONE
    SET_PHONE --> CREATE_PET
    CREATE_PET --> CREATE_TYPE
    CREATE_TYPE --> SET_TYPE_NAME
    SET_TYPE_NAME --> SET_PET_TYPE
    SET_PET_TYPE --> SET_PET_NAME
    SET_PET_NAME --> SET_BIRTHDATE
    SET_BIRTHDATE --> ADD_PET
    ADD_PET --> SET_PET_ID
    SET_PET_ID --> RETURN_NODE
```

## 3. Parameter Analysis

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

This method has no input parameters. It reads the test class constant `TEST_OWNER_ID` and uses the current system clock via `LocalDate.now()` to set the pet birth date. The returned object is fully assembled from local state only.

## 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` |

The method performs no CRUD against persistence or service components. All calls are in-memory object construction and mutation on test fixtures.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|---------------------|
| C | `Owner` constructor | - | `Owner` | Creates a new owner aggregate for test data |
| U | `george.setId(TEST_OWNER_ID)` | - | `Owner` | Assigns the stable owner identifier used by controller tests |
| U | `george.setFirstName("George")` | - | `Owner` | Sets the owner's given name |
| U | `george.setLastName("Franklin")` | - | `Owner` | Sets the owner's family name |
| U | `george.setAddress("110 W. Liberty St.")` | - | `Owner` | Sets the mailing address |
| U | `george.setCity("Madison")` | - | `Owner` | Sets the city for the owner profile |
| U | `george.setTelephone("6085551023")` | - | `Owner` | Sets the contact telephone number |
| C | `Pet` constructor | - | `Pet` | Creates a new pet record for the owner fixture |
| C | `PetType` constructor | - | `PetType` | Creates a new pet type record |
| U | `dog.setName("dog")` | - | `PetType` | Defines the pet type as dog |
| U | `max.setType(dog)` | - | `Pet` / `PetType` | Associates the pet with its type |
| U | `max.setName("Max")` | - | `Pet` | Assigns the pet name |
| U | `max.setBirthDate(LocalDate.now())` | - | `Pet` | Sets the pet birth date to the current date |
| C | `george.addPet(max)` | - | `Owner` / `Pet` | Adds the pet to the owner's pet collection |
| U | `max.setId(1)` | - | `Pet` | Assigns a test pet identifier after association |

## 5. Dependency Trace

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

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

This helper is called internally from the same test class and is used to produce reusable sample data for controller assertions. The dependency chain stays entirely within the test fixture layer and does not reach any screen, batch, CBS, or database boundary.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Controller: `OwnerControllerTests` | `OwnerControllerTests.george()` | `Owner/Pet fixtures [C/U] Owner, Pet, PetType` |

## 6. Per-Branch Detail Blocks

**Block 1** — `SET` `(Owner fixture initialization)` (L71-L72)

> Creates the owner test aggregate that will be populated with canonical sample data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Owner george = new Owner();` |

**Block 2** — `SET` `(Owner identity and contact population)` (L73-L78)

> Populates the owner profile fields used by controller tests.

| # | Type | Code |
|---|------|------|
| 1 | SET | `george.setId(TEST_OWNER_ID);` [-> `TEST_OWNER_ID`="test owner id"] |
| 2 | SET | `george.setFirstName("George");` |
| 3 | SET | `george.setLastName("Franklin");` |
| 4 | SET | `george.setAddress("110 W. Liberty St.");` |
| 5 | SET | `george.setCity("Madison");` |
| 6 | SET | `george.setTelephone("6085551023");` |

**Block 3** — `SET` `(Pet and pet type fixture initialization)` (L79-L82)

> Creates the nested pet aggregate and its type so the owner fixture includes one registered pet.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Pet max = new Pet();` |
| 2 | SET | `PetType dog = new PetType();` |
| 3 | SET | `dog.setName("dog");` |
| 4 | SET | `max.setType(dog);` |
| 5 | SET | `max.setName("Max");` |

**Block 4** — `SET` `(Pet lifecycle and ownership association)` (L83-L86)

> Completes the pet fixture by setting the birth date, attaching it to the owner, and assigning a test identifier.

| # | Type | Code |
|---|------|------|
| 1 | SET | `max.setBirthDate(LocalDate.now());` |
| 2 | CALL | `george.addPet(max);` |
| 3 | SET | `max.setId(1);` |

**Block 5** — `RETURN` `(return constructed owner)` (L87-L88)

> Returns the fully populated owner test fixture to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return george;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `Owner` | Domain entity | A clinic customer who owns one or more pets |
| `Pet` | Domain entity | An animal registered under an owner in the clinic system |
| `PetType` | Domain entity | A classification for a pet, such as dog or cat |
| `TEST_OWNER_ID` | Test constant | Stable identifier used to make the owner fixture deterministic |
| `LocalDate.now()` | Technical API | Current system date used here as the pet birth date for test data |
| `George` | Business term | Sample first name used for the canonical owner fixture |
| `Franklin` | Business term | Sample last name used for the canonical owner fixture |
| `Madison` | Business term | Sample city used in the owner fixture address record |
| `110 W. Liberty St.` | Business term | Sample street address for the owner fixture |
| `6085551023` | Business term | Sample telephone number for the owner fixture |
| `dog` | Business term | Sample pet type name indicating a dog |
| `Max` | Business term | Sample pet name included in the owner fixture |
| `addPet` | Technical method | Associates a pet with an owner aggregate |
