# Getting Started

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

## What This Project Does

This is a minimal Java application centered on an `OrderService` class, paired with a variety of test classes written in different styles — JUnit 3, JUnit 4, and TestNG. It serves as a test harness or demonstration project, likely for evaluating static analysis, test detection, or code quality tooling. The codebase intentionally includes edge cases: test classes living in `src/main`, near-miss classes that look like tests but aren't, and standalone test artifacts outside the standard source tree.

## Recommended Reading Order

| # | Page | Why read it first |
|---|------|-------------------|
| 1 | [Repository Overview](../overview.md) | High-level architecture, technology stack, and project context |
| 2 | `src/main/java/com/example/OrderService.java` | The only production class — understand the domain |
| 3 | `src/main/java/com/example/TestHelper.java` | Minimal utility class that reveals the coding style |
| 4 | `src/test/java/com/example/OrderServiceTest.java` | Standard JUnit 4 test in the conventional layout |
| 5 | The "special cases" — `RogueTestAnnotated`, `TestNGTest`, `ImportOnlyTest`, `UnannotatedInTest`, `LegacyTest` | Edge cases for test detection logic |

The entire codebase is small enough that reading all nine files top-to-bottom will give you complete familiarity.

## Key Entry Points

These are the classes that anchor your understanding of the codebase:

- **`OrderService`** — The central business class in `src/main/java/com/example/`. It is the only production class and provides a `run()` method. Everything else revolves around it.
- **`OrderServiceTest`** — The primary test class in `src/test/java/com/example/`. Shows how `OrderService` is exercised.
- **`TestHelper`** — A minimal helper utility in the same package. Useful for orienting yourself to the coding style and import conventions.

## Project Structure

The repository is organized into four top-level directories, each serving a different purpose:

```mermaid
flowchart TD
    Main["src/main
Main source"]
    Test["src/test
Test source"]
    Utils["src/utils
Utilities"]
    Standalone["standalone
Standalone tests"]
    Main --> OrderService["OrderService"]
    Main --> TestHelper["TestHelper"]
    Main --> LegacyTest["LegacyTest
JUnit 3 style"]
    Main --> RogueTestAnnotated["RogueTestAnnotated
JUnit 4 in main"]
    Main --> TestNGTest["TestNGTest
TestNG in main"]
    Test --> OrderServiceTest["OrderServiceTest
JUnit 4"]
    Test --> UnannotatedInTest["UnannotatedInTest
No annotations"]
    Utils --> ImportOnlyTest["ImportOnlyTest
Import-only"]
    Standalone --> OrderServiceTestStandalone["OrderServiceTestStandalone
JUnit 4 standalone"]
```

### `src/main/java/com/example/` — Main source code

The primary source directory. Contains the production class and several intentional edge cases:

- **`OrderService`** — The core business logic class.
- **`TestHelper`** — A minimal utility class with no methods or fields (stub).
- **`LegacyTest`** — A JUnit 3-style test class extending `TestCase`. Placed in `main` rather than `test`.
- **`RogueTestAnnotated`** — A JUnit 4-style annotated test (`@Test`) living in `src/main`. Used as an edge case for test detection logic.
- **`TestNGTest`** — A class using TestNG's `@Test` annotation, also in the main source tree.

### `src/test/java/com/example/` — Standard test source

Follows the conventional Maven test layout:

- **`OrderServiceTest`** — A JUnit 4 test class with an annotated test method for `OrderService`.
- **`UnannotatedInTest`** — A test-like class with no JUnit/TestNG annotations. Methods look like tests but standard runners would not discover them.

### `src/utils/` — Utility classes

- **`ImportOnlyTest`** — Imports JUnit's `@Test` annotation but defines no test methods. A near-miss case for test detection heuristics.

### `standalone/` — Standalone test artifacts

- **`OrderServiceTestStandalone`** — A self-contained JUnit 4 test class outside the standard source tree, likely used to test classpath or scanner discovery.

## Configuration

This is a minimal project with no complex build configuration. Key files to be aware of:

- No `pom.xml` or `build.gradle` was detected at the root. The project may be built with a simple `javac` invocation or an external build script not included here.
- No application properties, YAML, or XML config files were found. The project is code-only.
- The `.codewiki/` directory contains auto-generated documentation metadata (`overview.md`, `tree.json`) — not something you need to edit.

If you need to add or run tests, you will need to configure your own JUnit/TestNG classpath and test runner.

## Common Patterns

### Test Detection Edge Cases

This codebase intentionally tests the boundaries of test detection. When scanning for tests, be aware of these categories:

| Category | Example | Would a test runner find it? |
|----------|---------|------------------------------|
| Standard test in `src/test/` | `OrderServiceTest` | Yes (JUnit 4 `@Test`) |
| Test class in `src/main/` | `RogueTestAnnotated` | Yes, if the runner includes `main` in its classpath |
| JUnit 3 legacy (`TestCase` subclass) | `LegacyTest` | Yes, if JUnit 3 runner is configured |
| TestNG test in `src/main/` | `TestNGTest` | Yes, with TestNG runner |
| No annotations, test-like methods | `UnannotatedInTest` | No |
| Imports `@Test` but no methods | `ImportOnlyTest` | No |
| Standalone file outside tree | `OrderServiceTestStandalone` | Only if explicitly added to classpath |

### Coding Style

- All classes live in the `com.example` package (except `ImportOnlyTest` in `src/utils/` and the standalone file).
- No framework dependencies beyond JUnit and TestNG annotations.
- Classes are minimal — the project is intentionally small, with no layers, interfaces, or architectural indirection.
- Methods follow simple naming conventions: `run()` for business logic, `test*` or `*Test` for test methods.

### Directory Conventions

- **`src/main/`** — Production code (and intentional test edge cases).
- **`src/test/`** — Standard test code following Maven conventions.
- **`src/utils/`** — Utility classes that are not part of the core domain.
- **`standalone/`** — Self-contained artifacts outside the standard layout.
