# Getting Started

I just joined the team — where do I start reading?

## What This Project Does

This is a small Java codebase centered around order processing and testing. At its heart is the `OrderService` class, which provides order processing functionality. The repository also includes a variety of test classes demonstrating different testing approaches — from legacy JUnit 3 style to modern JUnit 4 and TestNG patterns — making it a useful example for exploring Java testing patterns and legacy test migration.

## Recommended Reading Order

Start here if you're new to the codebase. Each step builds on the previous one.

1. [Overview](../overview.md) — High-level map of the entire codebase
2. `src/main/java/com/example/OrderService.java` — Core service, understand its `run()` method
3. `src/test/java/com/example/OrderServiceTest.java` — Primary test showing expected behavior
4. `src/main/java/com/example/TestHelper.java` — Shared test utility for test structure context
5. `src/main/java/com/example/LegacyTest.java` — Legacy JUnit 3 style, see what to migrate
6. `src/main/java/com/example/RogueTestAnnotated.java` and `src/main/java/com/example/TestNGTest.java` — Test-like code living in production sources
7. `standalone/OrderServiceTest.java` — Standalone test that runs outside the standard build tree

## Key Entry Points

| Class | File | Why read it first |
|---|---|---|
| **OrderService** | [OrderService.java](../src/main/java/com/example/OrderService.java) | Core service; everything else tests or wraps it |
| **OrderServiceTest** | [OrderServiceTest.java](../src/test/java/com/example/OrderServiceTest.java) | Shows how the service is used and expected to behave |
| **TestHelper** | [TestHelper.java](../src/main/java/com/example/TestHelper.java) | Shared test infrastructure used across test classes |

## Project Structure

```
.
├── src/main/java/com/example/     ← Production code + test-like classes
│   ├── OrderService.java           Core order processing logic
│   ├── TestHelper.java             Shared test utilities
│   ├── LegacyTest.java             JUnit 3 style (legacy)
│   ├── RogueTestAnnotated.java     JUnit 4 @Test in main source
│   └── TestNGTest.java             TestNG @Test in main source
├── src/test/java/com/example/      ← Standard test suite
│   ├── OrderServiceTest.java       JUnit 4 unit tests for OrderService
│   └── UnannotatedInTest.java      No-test-annotation class (helper/setup?)
├── src/utils/                      ← Utility tests
│   └── ImportOnlyTest.java         JUnit import-only utility (mixin?)
└── standalone/                     ← Independent tests
    └── OrderServiceTest.java       Standalone JUnit 4 test
```

The codebase uses the standard `src/main/java` / `src/test/java` layout, plus two non-standard directories:

- **`src/utils/`** — Utility classes imported by other tests but that don't define runnable tests themselves.
- **`standalone/`** — Test class that lives outside the standard build tree and can be executed independently.

## Architecture

```mermaid
flowchart TD
    Main["Main Sources"]
    Test["Test Sources"]
    Utils["Utils"]
    Standalone["Standalone"]

    Main --> OS["OrderService"]
    Main --> LH["LegacyTest"]
    Main --> RA["RogueTestAnnotated"]
    Main --> TN["TestNGTest"]

    Test --> OST["OrderServiceTest"]
    Test --> UI["UnannotatedInTest"]

    Main -. uses .- OS
    OST -. tests .- OS
    RA -. tests .- OS
    TN -. runs .- OS
    UI -. references .- OS
```

## Configuration

- **No build tool detected** — There is no `pom.xml`, `build.gradle`, or similar config file in the repository. Java files are compiled and run directly (or via classpath inclusion).
- **Package**: All classes live in the `com.example` package.

## Common Patterns

**Testing frameworks in use**: This codebase intentionally mixes three testing styles. When writing new code, be aware of which style a given file uses:

- `junit.framework.TestCase` — JUnit 3 (legacy). The `LegacyTest` class extends `TestCase` and overrides `runTest()`-style methods.
- `org.junit.Test` — JUnit 4. The `OrderServiceTest` class and others use `@Test` annotations with modern assertions.
- `org.testng.annotations.Test` — TestNG. The `TestNGTest` class uses TestNG annotations.

**Test-like code in production sources**: Both `RogueTestAnnotated.java` and `TestNGTest.java` are located in `src/main/java` and contain `@Test` annotations. This is unusual — test methods typically live in test directories. Be cautious about running these against production code.

**Naming convention**: Classes follow PascalCase. Test classes end with `Test` or `Tests`.

**Source file count**: 9 source files across 4 directories. A compact, approachable codebase.
